html2canvas icon indicating copy to clipboard operation
html2canvas copied to clipboard

persian language propblem

Open bshafiei-ir opened this issue 8 years ago • 4 comments

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

bshafiei-ir avatar Mar 14 '18 11:03 bshafiei-ir

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

MohammadGoodarzi avatar Jul 14 '20 05:07 MohammadGoodarzi

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

AldeonMoriak avatar Jan 04 '22 11:01 AldeonMoriak

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] })
      }
    })``

amirmansoori avatar Nov 11 '23 07:11 amirmansoori

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

this way work for me

milladka avatar Dec 01 '25 07:12 milladka