user1579878
user1579878

Reputation: 107

iText Arabic flipped and re-arranged with RTL

I am having an issue with certain mixed arabic/English data. Here is the code I use:

ColumnText column = new ColumnText(writer.getDirectContent()); 
column.setSimpleColumn(36, 770, 569, 36); 
column .setRunDirection(PdfWriter.RUN_DIRECTION_RTL);      
column.setArabicOptions(column.AR_NOVOWEL |                  
                      column.AR_LIG |                      
                      column.AR_COMPOSEDTASHKEEL);   

This the original Data

2 ‏ ‏ ‎تغــيير ‎3010 E02‎

Data after pdf generation

E02 3010 رييغت ‎2

If I change to column.setRunDirection(PdfWriter.RUN_DIRECTION_NO_BIDI) the line comes out correct but the arabic is unshaped.

Upvotes: 1

Views: 1091

Answers (2)

user1579878
user1579878

Reputation: 107

The IBM bidi layout and the iText bidi processing seemed to be interfering with each other.I used RUN_DIRECTION_NO_BIDI and used the JAVABIDI flags here: http://www.ibm.com/developerworks/java/jdk/bidirectional/JAVABIDI.html
Now the iText PDF arabic is perfect in all cases.

However I am now having an issue with the PDF Metadata, which is now showing the same flipping issue when I have mixed Arabic/Latin data there, is there a way to turn off the bidi at the Metadata level?

Upvotes: 0

Paulo Soares
Paulo Soares

Reputation: 1916

The result is correct. The numbers are neutral and will follow the current direction. In this example we start with R for the number 2 then R for the arabic then R for the number 3010 then L for E02.

Upvotes: 1

Related Questions