We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Arabic text not visible in pdf - textfragment used to write text


I am trying to add text fragment in an existing pdf, when I add the english text it appears fine, but when i try to add arabic content its not visible to the user, I observed that when select and copy + pase the content in a note pad, i can see the content which i have written in to the pdf.

Please find the attached screenshots for the more details, also added code snippet and pdf document which i used to update the text.

I observed this is happening with latest version of aspose pdf jar 10.8.0, when i tested with old version of aspose(10.2.0) it was fine.

can you please let me know what could be the issue.

Thanks in advance,

Hi Hana,

Thanks for using our API’s.

We are working on replicating the issue in our environment and will get back to you soon. We are sorry for your inconvenience.

Hi Hana,

Thanks for your patience.

I have managed to notice the Arabic text invisible issue in earlier shared PDF file and in order to replicate the problem, I have tried using following code snippet but I am getting an OutOfMemory exception when using latest release of Aspose.Pdf for Java 11.0.0. However can you please share your input PDF file which you are using, so that we can test the scenario in our environment. We are sorry for this inconvenience.


com.aspose.pdf.Document pdfDocument = new

Page page = pdfDocument.getPages().add();

Table table = new Table();

float topMargin = (float)page.getPageInfo().getHeight() - 20;//-this should be same as bottom margin set

//float leftMargin = (float)page.getPageInfo().getWidth() - 70;



table.setColumnWidths(String.valueOf(220));//this will display no of char per line


//table.setBorder(new BorderInfo(com.aspose.pdf.BorderSide.All, Color.getBlack()));

com.aspose.pdf.Row r1 = table.getRows().add();

com.aspose.pdf.Cell cell = r1.getCells().add();

com.aspose.pdf.Image image = new com.aspose.pdf.Image();




Table tab2 = new Table();

//table.setColumnWidths("220 30 220");

//(emptyspace signimage(80) emptyspace)

tab2.setColumnWidths("70 80 70"); //this total should match to the column width mentioned in prev method -80 for sign image to fit

//tab2.setDefaultCellBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All));


com.aspose.pdf.Row r2 = tab2.getRows().add();

Cell c1 = r2.getCells().add();

Cell c2 = r2.getCells().add();



Cell c3 = r2.getCells().add();

com.aspose.pdf.Row r3 = tab2.getRows().add();

Cell c4 = r3.getCells().add();



String prefix ="مدير ادارة الموارد البشرية";

String visibleName ="مدير ادارة الموارد البشرية";

TextFragment name =

new TextFragment((prefix == null || "".equals(prefix)) ?

visibleName : prefix + " " + visibleName);

TextFragment designation =

new TextFragment("مدير ادارة الموارد البشرية");

TextFragment entity =

new TextFragment("مدير ادارة الموارد البشرية");


TextFragment spaceFrag = new TextFragment("");








//add empty line to the cell

//TextFragment emptyLine1 = new TextFragment("");



Thank you for looking in to the issue reported.

Please find the pdf file which we use to add text in it.

Thanks in advance!

Hi Hana,

Thanks for sharing the resource file.

I have again tested the scenario while using code snippet shared in my earlier post 675658 (I have loaded your shared PDF file in Document instance) and I am still getting OutOfMemory exception. For the sake of correction, I have logged this problem
PDFNEWJAVA-35364 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.

Thank you for the update!

Please let me know if further details required on this and update us once the issue is resolved.


Hi Hana,

As soon as we have some definite updates regarding its resolution, we will surely update you within this forum thread. Please be patient and spare us little time.

The issues you have found earlier (filed as PDFNEWJAVA-35364) have been fixed in Aspose.Pdf for Java 11.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.