Skip to content
Advertisement

Arabic Text issue with PDFKit plugin

To generate dynamic PDF files, I’m using PDFKit. The generation works fine, but I’m having trouble displaying arabic characters, even after installing an arabic font. Also, Arabic text is generated correctly, but I believe the word order is incorrect.

As an example,

I’m currently using pdfkit: “0.11.0”

Text: مرحبا كيف حالك ( Hello how are you )

Font: Amiri-Regular.ttf

JavaScript

OUTPUT:

PDF with arabic text

Advertisement

Answer

this problem allowed me to go through here, but unfortunately I am not convinced by the answers posted and even add a library to change the direction of the text with pdfkit. after several minutes on the pdfkit guide docs, here is the solution:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement