-
Notifications
You must be signed in to change notification settings - Fork 4.7k
JSPDF problem FortAwesome #1309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How about providing some code example??? |
Hi @viktordart, PDF Specifications has only a few 14 fonts available by default, http://www.enfocus.com/manuals/ReferenceGuide/PP/10/enUS/en-us/concept/c_aa1140975.html With JSPDF see the function addFont to inclure your icons into the PDF, with regards, |
Hi, I put part of the code:
A example HTML:
I have imported another icon source: http://ionicons.com/ and with that I have not problems thanks! |
great ! regards, |
Hello, Is there any way to fix it? Thank you |
what the error ? could you send me the PDF file please. |
i trust the fact that the font/icon is not visible in your PDF but if you share your PDF result i can dig into the generated code and see if the font as an external ressources is actually in the PDF file. if you want to check by yourself use PDF specifications available here (http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf) page 390. |
Hello,
I have checked that yes I remove those properties (-webkit *), they are exported correctly, even without importing the fonts to the document. Is there any way I can interpret those properties? Thank you! |
Hello,
Thanks for everything! |
@havenchyk great news ! |
Hi @buenjybar
I also tried to add FontAwsome ttf font like @viktordart did but it didn't work.
|
Hi, Right now i am working on integrating Fonts into the pdf file, the things is UTF-8 is not a recognized standard for PDF , so even if your font is embedded inside your PDF, you cannot call it using utf-8 encoded character. I will PR really soon and link it to this message. |
@neerajbhatt29 Did you found solution for including font? |
May I ask till now, is there a way to support FortAwesome in jsPdf? |
I'm still unable to get this to work with the inclusion of the new addFont features. const doc = new jsPDF({ orientation: pdfState?.orientation });
await doc.addFileToVFS('fontawesome-webfont-normal.ttf', font); //font is the base64 encored font
await doc.addFont('fontawesome-webfont-normal.ttf', 'fontawesome-webfont', 'normal');
await doc.setFont('fontawesome-webfont', 'normal');
await doc.html(content, {
html2canvas: { scale: pdfState?.scale },
margin: pdfState?.pageMargin,
fontFaces: [
{
family: "fontawesome-webfont",
style: "normal",
src: [{
url: font,
format: "truetype"
}],
}
]
});
return doc; |
Are you using the latest version of jsPDF? Yes
Have you tried using jspdf.debug.js? Yes
Steps to reproduce Export addHTML with fonts FortAwesome
What I saw
Icons are not exported
What I expected
That the icons are displayed in the export
Thanks
The text was updated successfully, but these errors were encountered: