I’m currently working on generating PDFs using pdfmake and need to include Arabic text, which requires proper handling of RTL (Right-To-Left) formatting. However, I’m facing issues with the display of the text.
When I generate the PDF using pdfmake, the text appears as:
Through my research, I found a code snippet that partially resolves the issue by reversing the word order:
.split(' ').reverse().join(' ')
This works to some extent, but it fails in scenarios where the text includes numbers, brackets, or if the text is long and spans multiple lines. In such cases, the text gets jumbled, starting from the last line to the first one.
Any advice or solutions to handle this properly would be greatly appreciated. Thank you!
Reversing the words using .split(‘ ‘).reverse().join(‘ ‘), which partially works but introduces new issues with numbers and multiline text.
I am expecting to display the Arabic text correctly in the PDF, preserving the correct RTL format, including proper handling of numbers, punctuation, and multiline text.