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

Free Support Forum - aspose.com

Unicode support issue

Hi support,

This is an urgent matter. By writing text.getTextInfo().setIsUnicode(true) I get java errors (java.io.UnsupportedEncodingException: Identity-H) when the font for that text is not set. The issue can be reproduced with the following code:

Pdf pdf1 = new Pdf();

Section sec1 = pdf1.getSections().add();

Text text1 = new Text(sec1,"my text");

text1.getTextInfo().setIsUnicode(true);

sec1.getParagraphs().add(text1);

FileOutputStream out = new FileOutputStream(new File("C:/Temp/UnicodeMethodIssue.pdf"));

pdf1.save(out);


Thank you,
Milan Cutlac

Hello Milan,

We apologize for your inconvenience.

I have tested the issue, and I am able to reproduce the same problem. The issue has already been communicated to the development team, and soon you will be updated with the status of correction.

Hi support,

Please confirm if the issue shall be solved in this week.

Thank you,
Milan

Hello milan,

We are working on this issue for several days. We probably will find a solution in this week. But we cannot promise that we will finish it in this week for one hundred percent.

Thank you for your patience.

Hello milan,

We have checked this issue carefully and found that the adobe type 1 fonts do not support unicode encoding. The default font of our product is “Times-Roman”, which belongs to adobe type fonts. So if you want to display the unicode character, it’s a better idea to use other fonts, such as TrueType fonts. You can find more information about TrueType fonts at:
http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/use-truetype-fonts.html

Hopefully this helps, thank you for using our product.

Hi support,

The type of the text that is written at run-time is unknown. Thus, I use "setIsUnicode" method to make sure that I'll get in the output any embedded Unicode characters. If I use the method and I do not set the font family, it crashes. If I set the default Adobe font, "Times New Roman", it does not crash, but I get no Unicode text in the output (e.g. , the character "0x4E84" is not written). If I set "Arial Unicode MS" for the text object, I'll obtain the Unicode character, but this overwrites the font family for entire text object, which is not convenient : it might contain non-Unicode characters.


Please advice,
Milan

[ Setting the font family just for the Unicode characters requires a way to detect those ; is there any way to do that ? ]

Dear Milan,

Since the type of the text that is written at run-time is unknown, you can only use some common fonts that can display unicode such as "Arial Unicode MS" to make sure all text can be displayed. This is a limitation of Aspose.Pdf. Sorry for the inconvenience.

The issues you have found earlier (filed as 5919) have been fixed in this update.