Free Support Forum - aspose.com

Do to display Japanese in PDF by using Aspose.Pdf for java?

Hello.
A Japanese part alone is not displayed though it tries to display Japanese in PDF
by using Aspose.Pdf for Java.
The version used is 2.0.0.0. Is it wrong anywhere?
It executes it in the following sources.

Pdf wpdf = new Pdf();
Section sec = wpdf.getSections().add();
Text txt = new Text(sec, new String(hire Japanese Strings.getBytes(), “UTF-8”));
sec.setTextInfo(sec.getTextInfo().setFontName(“MS-Gothic”));
sec.setTextInfo(sec.getTextInfo().setFontEncoding(EncodingType.Identity_H));

sec.getParagraphs().add(txt);

We will test this problem and reply to you soon.

Here is an example:

Pdf wpdf = new Pdf();
Section sec = wpdf.getSections().add();
Text txt = new Text(sec, "This test show how Japanese is supported\n");
String trueTypeFontFile = "c:/windows/fonts/MSGOTHIC.ttc,1";
txt.getTextInfo().setTrueTypeFontFileName(trueTypeFontFile);

String s = new String("となりました");
txt.getSegments().add(s);

sec.getParagraphs().add(txt);

wpdf.save(new java.io.FileOutputStream( new File("C:\\TESTJAPANESE.PDF")));

Thank you.
It only has to specify the font file name directly.
By the way, at Linux, is it good in a similar method?


It is the good way to use in Linux.

Please tell us any problems if you have in Linux.

Thank you.
Linux is variously tried.