You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm using the last version 2.5.1 but I can't render a PDF with Hebrew, even if I Set the language, for example:
`const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.setFont('Arial');
doc.text(10, 10, 'תן אישור כשירות מחדש ע"י רשות הרישוי ינתן עם החזרת טופס הודעה בדבר תקינות הרכב החתום ע"י מכון הרישוי.');
doc.setLanguage("he")
doc.save('MyTest.pdf');
`
What I see in the PDF:
Thanks in advance
The text was updated successfully, but these errors were encountered:
I have been using jsPDF for quite some time and have worked with various languages. The default fonts in jsPDF do not support Hebrew or other right-to-left (RTL) languages out of the box. Additionally, setting the language in jsPDF (doc.setLanguage("he")) does not automatically enable proper rendering for non-Latin scripts like Hebrew.
import{jsPDF}from"jspdf";// This is the Base64 font.importhebrewFontfrom"./font.js";constdoc=newjsPDF();doc.addFileToVFS("hebrew.ttf",hebrewFont);doc.addFont("hebrew.ttf","hebrew","normal");doc.setFont("hebrew");// Use the added Hebrew fontconsthebrewText=`"תן אישור כשירות מחדש ע"י רשות הרישוי ינתן עם החזרת טופס הודעה בדבר תקינות הרכב החתום ע"י מכון הרישוי."`;doc.text(hebrewText,10,10,{align: "right"});// Use align "right" for RTLdoc.save("MyTest.pdf");
References
If you need more references, check out my repository: - Recibill
I’ve implemented it here: - Recibill PDF Utils
If you still face issues, then you can go to my profile and you will find my contact details there.
Hello,
I'm using the last version 2.5.1 but I can't render a PDF with Hebrew, even if I Set the language, for example:
`const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.setFont('Arial');
doc.text(10, 10, 'תן אישור כשירות מחדש ע"י רשות הרישוי ינתן עם החזרת טופס הודעה בדבר תקינות הרכב החתום ע"י מכון הרישוי.');
doc.setLanguage("he")
doc.save('MyTest.pdf');
`
What I see in the PDF:
Thanks in advance
The text was updated successfully, but these errors were encountered: