Free Support Forum - aspose.com

Multi byte characters not getting displayed in PDF

Hi There,

I am using Aspose license for PDF (in java). In my application I am trying to export a PDF having some multi byte characters. But it is unable to display it properly.

It is able to display characters like ½ ¼ ¾ ⅓ ⅔ † ‡ µ ¢ £ € « in PDF successfully but for some other characters like ยงยงยง, it is failing.

I am using following code

Document doc = new Document();
PageInfo pageInfo = doc.getPageInfo();
pageInfo.setLandscape(true);
Page curPage = doc.getPages().add();
Paragraphs paragraphs = curPage.getParagraphs();
Font textFont = FontRepository.openFont(Demo.class.getClassLoader().getResourceAsStream("fonts/ARIALUNI.TTF"), FontTypes.TTF);
textFont.setEmbedded(true);
TextFragment textFragment = new TextFragment();
textFragment.getTextState().setFont(textFont);
textFragment.setText("ยงยงยง");
paragraphs.add(textFragment);
TextFragment textFragment2 = new TextFragment();
textFragment2.getTextState().setFont(textFont);
textFragment2.setText(" ½ ¼ ¾ ⅓ ⅔ † ‡ µ ¢ £ € « » ♠ ♣ ♥ ♦ ¿ �");
paragraphs.add(textFragment2);
doc.save("test.pdf");

Would you please let me know if I am missing anything?

Thank you.

@RahulU

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFJAVA-37679 has been logged in our issue management system for further investigation and resolution. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

We are sorry for the inconvenience.

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