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

Free Support Forum - aspose.com

Text is not Rendered while add Arabic Text in PDF using Noto Sans Arabic Font in Java

Aspose pdf 21.10 for java does not handle all Arabic chars e.g:

var font = FontRepository.findFont("Noto Sans Arabic");

var textState = new TextState();
textState.setFontSize(9);
textState.setFontStyle(FontStyles.Regular);
textState.setForegroundColor(Color.getBlack());
textState.setLineSpacing(5F);
textState.setFont(font);

var text = "ق - ن - ف";

System.out.println(font.doesFontContainAllCharacters(text));

var textFragment = new TextFragment(text);
textFragment.getTextState().applyChangesFrom(textState);

var document = new Document();
var page = document.getPages().add();
page.getParagraphs().add(textFragment);
document.save("HelloWorld_out.pdf");

Output HelloWorld_out.pdf instead of “ق - ن - ف” contains " - - ", but some other Arabic chars works fine - please check above example with “أسعار”.

This occurs with Noto Sans Arabic https://fonts.google.com/noto/specimen/Noto+Sans+Arabic which handle all Arabic chars (including “ق - ن - ف”)

Moreover font.doesFontContainAllCharacters(text) returns true

@wjeczalik

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as PDFNET-50931. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Tahir,

It has been quite a while since you replicated the issue. Can you let me know when it would be fixed? Our customers are waiting for it as they are not able to generate proper PDF files.

Best regards,

Wojtek

@wjeczalik

Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.

It has been 6 months since I opened this ticket. Can you make sure this is resolved asap?

Best regards,

Wojtek

@wjeczalik

We have planned to investigate this issue. Once there is any update available on it, we will be more than happy to share it with you. Thanks for your patience.

The issues you have found earlier (filed as PDFNET-50931) have been fixed in Aspose.PDF for .NET 22.6.

@tahir.manzoor
Are you planning to introduce the fix for Java? If so, when can we expect that?
Thanks!

@wjeczalik

We have logged separate issue for Aspose.PDF for Java as PDFJAVA-41946. We will inform you once there is an update available on it. We apologize for your inconvenience.

@wjeczalik

Hopefully, the fix of this issue will be available in the next version of Aspose.PDF for Java i.e. 22.8. We will inform you via this forum thread once there is an update available on it.

The issues you have found earlier (filed as PDFJAVA-41946) have been fixed in Aspose.PDF for Java 22.9.

@tahir.manzoor
The issue still exists. We checked it on this example.

Font font= FontRepository.findFont("Noto Sans Regular");
TextState tstate= new TextState();
tstate.setFont(font);

Document document = new Document();

document.getPageInfo().setDefaultTextState(tstate);

Page page = document.getPages().add();
TextFragment paragraph = new TextFragment("مرة أخرى إلى الأقلام أو المضخات اللاصقة الآن.");
paragraph.getTextState().applyChangesFrom(tstate);
page.getParagraphs().add(paragraph);

document.save("Example.pdf");

Result in pdf file:
image (26).png (25.5 KB)

After copying text from a pdf file and pasting it into a word document, the text looks correct. Looks like pdf cut the text. Can you investigate the issue again?
Example (1).pdf (924.0 KB)

@wjeczalik

This issue has been logged as PDFJAVA-42067 in our issue tracking system. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi! Do you have any updates on when we can expect it to be resolved?
Thanks!

@wjeczalik

We have worked over issue and noticed that this issue is more related to fonts. Could you please provide the exact font file that cause the test cut problem. It could be the situation when glyphs in the font are designed in a way that symbols are placed out of the visible line of text. So, we need the exact font file to reproduce and fix the issue. Thanks for your cooperation.

@tahir.manzoor
Sure thing! Here’s a link to the font https://fonts.google.com/noto/specimen/Noto+Sans+Arabic
Please let us know if you need anything else or you have any updates.

@wjeczalik

We have logged this detail in our issue tracking system. We will inform you once there is an update available on it.

1 Like