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

Hi,

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.

[Java]

com.aspose.pdf.Document pdfDocument = new
com.aspose.pdf.Document();
<o:p></o:p>

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.setTop(topMargin);//680

table.setLeft(72);//70

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

page.getParagraphs().add(table);

//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();

image.setFile("c:/pdftest/aspose-Pdf-for-net_100.png");

image.setFixHeight(60);

image.setFixWidth(80);

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));

cell.getParagraphs().add(tab2);

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

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

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

c2.setAlignment(HorizontalAlignment.Center);//center

c2.getParagraphs().add(image);

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

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

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

c4.setAlignment(HorizontalAlignment.Center);

c4.setColSpan(3);

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

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

TextFragment name =

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

visibleName : prefix + " " + visibleName);

TextFragment designation =

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

TextFragment entity =

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

name.getTextState().setForegroundColor(com.aspose.pdf.Color.getBlack());

TextFragment spaceFrag = new TextFragment("");

spaceFrag.getTextState().setFontSize(4);

c4.getParagraphs().add(spaceFrag);

c4.getParagraphs().add(name);

c4.getParagraphs().add(spaceFrag);

c4.getParagraphs().add(designation);

entity.getTextState().setLineSpacing(4);

c4.getParagraphs().add(entity);

//add empty line to the cell

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

//c4.getParagraphs().add(emptyLine1);

pdfDocument.save(“c:/pdftest/ArabicTextAdded.pdf”);

Hi,
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
as
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.

Thanks,

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.