Jspdf: Make fromHTML capable of using customfonts

Created on 9 May 2018  路  11Comments  路  Source: MrRio/jsPDF

I have seen arabic/persian is supported now when using text function directly
but is there any way to convert an HTML containing arabic/persian text rendering correctly?

from_html.js

Most helpful comment

Doesn't html2pdf just create a large image of the HTML and wrap it inside a PDF-document? If yes, then it's a poor substitute for fromHTML() which renders the text as text (which importantly makes it selectable). If it's just an image, you won't be able to select the text in the document. For me, that's a massive no-go. If I want to generate an image, I'll do that. I don't really see the point of generate an image in a PDF-container.

All 11 comments

If you modify fromhtml/addHtml, then yes.

I read in documentatiom that addhtml is deprecated and using html2pdf (which looks like uses html2canvas internally) is prefered
Do you think it is possible to render persian/arabic text correctly using this new method?
If so please tell me which files I should edit

I really dont like to fiddle in those plugins. :/

how to modify fromHTML,please tell me specifically ,,thxthxthxthx!! @arasabbasi

Need to render html and display special character like euro symbol

Special symbols are supported in text function but not in fromhtml

We are closing this issue, because we will not support any longer fromHTML and addHTML.

Explaination:
We are working on a new html2pdf plugin, which will be based on html2canvas and our context2d plugin. This should lead to more reliable results for your projects. And it will give us the time to focus on the core functionality of pdf-generation because we will not use our energy for writing/supporting/extending 2 html plugins. If you still want to use addHTML or fromHTML you can still use jsPDF 1.4.1.

Best Regards

@arasabbasi Is the html2pdf plugin available now and able to use custom fonts for unicode? I can't find any information in the documentation.

Yes, check examples/html2pdf

Doesn't html2pdf just create a large image of the HTML and wrap it inside a PDF-document? If yes, then it's a poor substitute for fromHTML() which renders the text as text (which importantly makes it selectable). If it's just an image, you won't be able to select the text in the document. For me, that's a massive no-go. If I want to generate an image, I'll do that. I don't really see the point of generate an image in a PDF-container.

I agree with you @magnus-eriksson . I cannot understand why the function fromHTML is now deprecated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arulmb0136 picture arulmb0136  路  4Comments

allenksun picture allenksun  路  3Comments

centurianii picture centurianii  路  4Comments

0721Betty picture 0721Betty  路  4Comments

glaier picture glaier  路  3Comments