jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

Textoutput with ascii not working

Open tschero opened this issue 6 years ago • 1 comments

Hi Guys, I would like to work with ASCII and UTF-8 characters in one PDF. German umpaute (aä, ö, ß, etc.) are displayed correctly. However, the following code with converted ASCII characters (e.g. to represent a square) does not work: function run() { var doc = new jsPDF(); doc.setFontSize(40); doc.text(35, 25, 'Does this work?'); var res = String.fromCharCode(9633, 9635, 9634, 9711, 9673, 9675); doc.text(35, 45, res); doc.save('Testy.pdf'); }

jsbin_not_ok I tried this with jspdf.min (1.0.272, 1.5.3, 2.1.1)

Likewise, some special characters are not displayed correctly and instead pull the text apart. I am attaching a few sample pictures here.

The ASCII characters are displayed correctly in the JavaScript console of the FireFox browser. js_console_ok

Unfortunately not in the PDF.

ascii_not_ok

Further texts are also not correctly shown. I could find out that e.g. ( - ) is disturbing. String: Welche Schritte müssen im Rahmen der Verhältnismäßigkeit bei Maßnahmen nach den §§ 9 – 15 UZwGBw geprüft werden? Nennen Sie die drei Schritte!

PDF: text_not_ok

Many other texts are displayed correctly. text_ok

Best Regards

tschero avatar Mar 26 '20 08:03 tschero

See the pinned issue #2677.

HackbrettXXX avatar Mar 26 '20 08:03 HackbrettXXX