-
Notifications
You must be signed in to change notification settings - Fork 23
utf8 support #20
Comments
Did you add a font supporting these utf8 characters? |
I'm using the default font, but the same code works when using |
When I run the code with MrRio/jsPDF, it renders to |
We're having similar problem over here. It happens with many characters, such as |
If you think this is a bug, please do provide ways to reproduce the bug. |
Alright, so I got around to it and indeed it is not jspdf problem, sorry! Still, I have to say that the font situation here is complicated. I don't know if there's any improvement that can be made, though. Maybe even stating explicitly in the readme/docs that default fonts are not Unicode aware would be nice? |
@KenjiTakahashi - I'm facing a similar challenge with local exporting of Highcharts where I need unicode symbols. I've converted a unicode aware font But still the exported PDF shows garbled unicode characters. Can you share your approach and how you fixed it? |
Did you load the font file after jsPDF? |
Yep and when checking with e.g. |
Does it work if you manually add text to the pdf with this font? |
Yep, good idea and that works! The encoding is fine and the symbols are there. Highcharts makes a call to
|
What does the SVG look like that's passed to svg2pdf? Does it use your custom font? |
First thing I'd do is to use some pdf editor (I use |
Thanks for the suggestions and after some hacking it works now. It may very well be a problem with highcharts: highcharts/highcharts#6417 (comment). |
Hey there! I have the same issue using your fork of jsPDF. The custom font is Inter-bold.ttf (converted using the official base64 tool) and loaded with an own script tag just below the CDN link of your library. It is shown correctly in the browser but once you download the file as PDF and not open it in the browser, all glyphs are messed up. I use it like this:
You can reproduce the issue here: betastage.netlify.app |
Actually looks pixel-perfect for me when viewing on Chrome/Edge - what PDF viewer are you using? |
Please read again. It is showing correctly in the browser but not in the actual PDF if you open it not in the browser. PDF viewer is the built in "Preview" app of MacOS. By the way, adding the font like this:
is not working either. And i tried different other fonts. All with the same result. |
The PDF looks good to me, as well. It correctly contains the font and looks good in Chrome and in Adobe Reader. You probably ran into parallax#2743. Try to disable compression as a workaround. |
@HackbrettXXX Ahh nice! Indeed setting compression to false resolves the issue. Would be cool to mention this in the documentation. Thanks a lot. |
Texts don't render correctly depending on what text you write.
renders
þÿA " B
In the original version of jsPDF this is fixed. What are the plans on implementing that?
The text was updated successfully, but these errors were encountered: