Free Support Forum - aspose.com

RTL text gets messed up in PDF (aspose.words for Java 11.9)

Hi!

You really made great fixes for right-to-left languages in version 11.9.0, so in DOC and ODT format everything seems to work, even the table of content.

But in PDF the output of mixed text ends up in a complete mess: non-RTL text gets written backward!

Please have a look at my attached examples doc (correct) and pdf (error).



They can easily be created by the following code:

- - -

Document document = new Document();

DocumentBuilder builder = new DocumentBuilder(document);



builder.getParagraphFormat().setBidi( true );



builder.getFont().setName(“Arial”);

builder.getFont().setNameBi(“Times New Roman”);

builder.getFont().setBidi(true);

builder.getFont().setLocaleIdBi(1037);//hebrew



builder.write(“Some text and a date “);

String sField = “DATE”;

DateFormat dateformat = DateFormat.getDateInstance(DateFormat.SHORT, new Locale(“he”));

if(dateformat instanceof SimpleDateFormat)

sField += " \@ “” + ((SimpleDateFormat)dateformat).toPattern()+””";

String sFieldValue = dateformat.format(new Date());

builder.insertField( sField, sFieldValue);



builder.write(". “);

builder.write(”\u05D6\u05e8\u05d9\u05de\u05ea \u05ea\u05d4\u05dc\u05d9\u05db\u05d9\u05dd \u05e2\u05e1\u05e7\u05d9\u05d9\u05dd");



builder.getDocument().save(“C:\Temp\out.doc”);

builder.getDocument().save(“C:\Temp\out.pdf”);



- - -

Please tell me, when this issue will be fixed. Thanks in advance!

Torsten

Hi Torsten,

Thanks for your inquiry. While using the latest version of Aspose.Words i.e. 11.9.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-7370. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as WORDSNET-7370) have been fixed in this Aspose.Words for .NET 18.11 update and this Aspose.Words for Java 18.11 update.