-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When converting html to PDF all arabic words are reversed #984
Comments
having the same issue. Interestingly, if you add Arabic text in the sandbox, everything generates properly. I can't figure out what I do wrong compared to the code in the sandbox. |
Its interesting that free itext version has the same issue, but with paid version problem is solved. So its general problem that appears in multiple pdf libraries. |
String htmlString =
"<html lang=\"ar\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\" />\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n" +
" <title>سورة الفلق</title>\n" +
" <style>\n" +
" @font-face {\n" +
" font-family: 'Amiri';\n" +
" src: url('file:///Amiri-Regular.ttf');\n" +
" }\n" +
" body {\n" +
" font-family: 'Amiri', serif;\n" +
" direction: rtl;\n" +
" text-align: right;\n" +
" background-color: #f9f9f9;\n" +
" color: #333;\n" +
" padding: 20px;\n" +
" margin: 0;\n" +
" }\n" +
" .verse {\n" +
" margin-bottom: 20px;\n" +
" }\n" +
" .verse-number {\n" +
" font-weight: bold;\n" +
" color: #555;\n" +
" }\n" +
" </style>\n" +
"</head>\n" +
"<body>\n" +
" <div class=\"verse\">\n" +
" <span class=\"verse-number\">١</span> قُلْ أَعُوذُ بِرَبِّ ٱلْفَلَقِ\n" +
" </div>\n" +
" <div class=\"verse\">\n" +
" <span class=\"verse-number\">٢</span> مِن شَرِّ مَا خَلَقَ\n" +
" </div>\n" +
" <div class=\"verse\">\n" +
" <span class=\"verse-number\">٣</span> وَمِن شَرِّ غَاسِقٍ إِذَا وَقَبَ\n" +
" </div>\n" +
" <div class=\"verse\">\n" +
" <span class=\"verse-number\">٤</span> وَمِن شَرِّ ٱلنَّفَّٰثَٰتِ فِى ٱلْعُقَدِ\n" +
" </div>\n" +
" <div class=\"verse\">\n" +
" <span class=\"verse-number\">٥</span> وَمِن شَرِّ حَاسِدٍ إِذَا حَسَدَ\n" +
" </div>\n" +
"</body>\n" +
"</html>"; I tried providing the font path and it worked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use implementation 'com.openhtmltopdf:openhtmltopdf-pdfbox:1.0.10' to convert html to PDF. In HTML everything is ok, but in generated PDF letters in every Arabic word are reversed. نوع التذكرة becomes ةركذتلا عون. Is there any way to fix this? Or it is a bug?
The text was updated successfully, but these errors were encountered: