Creating Arabic Content with PDFKit & nodeJS

I am using pdfkit with nodejs to generate dynamically PDFs. the generation works fine, but I have a problem displaying Arabic characters even if I set up a font that supports Arabic.

The letters are displayed correctly, but the words are displayed character by character :(

here is my code

doc = new PDFDocument;
doc.pipe(fs.createWriteStream('output.pdf'));
var str = "فصل الربيع الزهور \n#nature #payesage #fleurs #plantes #vert #espace #temara #rabat #maroc #WeekEnd #balade #instamoment #instalife #instamaroc #photographie #macro #peace";
doc.font('resources/HelveticaNeueLTArabic-Roman.ttf').text(str);

      

Any thoughts or suggestions would be great.

+3


source to share





All Articles