niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.54k stars 4.8k forks source link

persian language propblem #1465

Open bshafiei-ir opened 6 years ago

bshafiei-ir commented 6 years ago

Hi I'm going to convert html to pdf. I used jsPDF for this. But it did not support persian language. So i found that i should first convert html to canvas and then add canvas to pdf file.

So my problem is that html2canvas change font and unicode. I'm using last version (html2canvas 1.0.0-alpha.10)

My Code is

html2canvas(thisObject.Options.target, { onrendered: function (canvas) { theCanvas = canvas;

            document.body.appendChild(canvas);

            canvas.toBlob(function (blob) {
                saveAs(blob, "Dashboard.png");
            });
        }
    }); 

And output: dashboard 1

MohammadGoodarzi commented 4 years ago

hi, use "word-break: normal;" in div css style

AldeonMoriak commented 2 years ago

In my case it was letter-spacing which wasn't set to 0.

amirmansoori commented 11 months ago
const screenshot = await html2canvas(document.getElementById('receip')!, {
      foreignObjectRendering: true,

      width: width,
      height: height,
    })
    screenshot.toBlob((res) => {
      if (res) {
        const receip = new File([res], 'reciep.png', { type: res.type })
        navigator.share({ files: [receip] })
      }
    })``