yWorks / svg2pdf.js

A javascript-only SVG to PDF conversion utility that runs in the browser. Brought to you by yWorks - the diagramming experts
MIT License
649 stars 98 forks source link

Custom font not work in svg2pdf #146

Closed djae88 closed 4 years ago

djae88 commented 4 years ago

I tried really hard to solve this myself and search a lot Issues I found many Issues about same problem but I couldn't find a solution after all

I refer to the documentation about custom fonts and make my font js file with https://rawgit.com/MrRio/jsPDF/master/fontconverter/fontconverter.html image and set my font too

image

and the test was great image

but when I add svg with same text image image image This doesn't work...

I have no idea about this

61 I found exactly same Issue too

and he solved this, but he didn't offer a solution

What am I missing? I'm really desperate. Even a small hint would be really appreciated. Thanks

yGuy commented 4 years ago

A self-contained example is always easier to debug, but I believe all that you are missing is the font-family declaration at the SVG text element! Compare with the example, here: https://github.com/yWorks/svg2pdf.js/blob/14ebb1e2354f41cf68fef1379751a953a2030357/test/specs/custom-fonts/spec.svg#L2

djae88 commented 4 years ago

Wow, Thank you very much for quick reply! you saved my day :)