Bug? How can I display Hebrew text in a table? doc.text() does it, but doc.table does not
See original GitHub issueAfter installing Hebrew fonts, doc.text(…) displays them, whilst doc.table(…) does not. How can I display Hebrew text in a table? I’m attaching the pdf file and here is my example code:
let doc = new jsPDF.jsPDF();
doc.addFont(‘libs/ofek/fonts/David.ttf’, ‘David’, ‘normal’); // this works
doc.addFont(‘libs/ofek/fonts/davidbd.ttf’, ‘davidbd’, ‘bold’); // this works
doc.setFont(“David”, “normal”); // set font
doc.setFontSize(16);
let headers;
let data;
doc.text(Michael Lev
, 10, 10);
doc.text(“מיכאל לאב”, 10, 20);
doc.text(“I am מיכאל לאב”, 10, 30);
headers = that.createHeaders([
“field_name”,
“field_value”
]);
data = [
{
field_name: “Michael”,
field_value: “Lev”
},
{
field_name: “מיכאל”,
field_value: “לאב”
}
];
doc.table(15, 60, data, headers, { autoSize: true });
doc.save(“a4.pdf”);
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top GitHub Comments
That’s odd. I just tested it with different fonts (Batang) and different characters (which should in theory make no difference), and it works. Does this only happen with your specific font? Or only with Hebrew characters? Which jsPDF version do you have?
This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.