I'm struggling with this problem for hours now but I can't find a way out, the problem is that:
I wrote a program that generate a pdf file using itext version 7 (and a lot of it) along with some statistics, every things is right till here, but when my pdf should contain some arabic strings they just appear from left to right, no matter what I've tried (changing fonts, using universal encodings, making the string inside a cell of table, using canvas, ...) I can't make them appear normally.
Here is a piece of code I use for displaying arabic strings:
PdfFont fArabic=PdfFontFactory.createFont(ARABICFONT,PdfEncodings.IDENTITY_H, true);
final String ARABIC = "u0627u0644u0633u0644u0627u0645 u0639u0644u064Au0643u0645";
document.add(new Paragraph(ARABIC).setFont(fArabic).setBaseDirection(BaseDirection.RIGHT_TO_LEFT));
Note: I think that itext 5 version perhaps can solve it but as I said I can't undone the code I wrote especially I have with it a third library for statistics and also the project is already late.I just want a solution using itext 7 version.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…