How to set Arabic language RTL in Jasper Report with Jaspersoft iReport 5.5.1

Hi All,

in our product (running JRE 1.8_202) we have several Jasper reports printing and, as we are trying to provide Arabic Language support, we would also like those Jasper reports to be printed in Arabic too.

First of all we have provided an Arabic properties file for report printings in order to print translated labels, headers and so on; and that is correctly detected.

What kind of configurations should we set up, both generally in the report and in single components?

For example, up to now we have set all Text Field components to be horizontally aligned from right to left and with PDF Encoding as CP1256 (Arabic) or with Identity-H. These does not seem to be enough as some arabic characaters are not correctly encoded/printed in the final PDF (they are showed as little squares, even if they are in Jasper Preview from our application). 

Moreover, mixed western and Arabic words in the same sentenced are not printed from right to left: for example, something RTL like "وصف-ID" (which is the original entered data) is instead printed as "ID-وصف"

The only work around we have found for theis is to wrap all Text Field Expressions, for example like this:

"\u202B"+($P{device}!=null ? $P{device} : "" )+( $P{device}!=null && $P{devices}!=null ? " - "+$P{devices}.get( $P{device} ) : "" )+"\u202C"

where \u202B and \u202C are UNICODE standard characters used by Bidi implementation of Java.

May you give us some advices to do that, please?

Enclosed to this post you can find an example of our Jasper Report.

lorenzo.vinci's picture
Joined: May 13 2021 - 4:10am
Last seen: 1 year 10 months ago

0 Answers:

No answers yet