Aspose converted PDF file does not display CJK character correctly

Hello all,

I am converting word to pdf file for multi-language environemnt. I noticed that CJK characters are not displayed properly. In my attachment, the original file is asianFonts.docx, I set the font folder to point to the ttf files from Dejavu-fonts ( I got that from https://en.wikipedia.org/wiki/Help:Multilingual_support_(East_Asian)).

The converted pdf file is asianFonts.pdf in the attachments.

The following is my code:

FontSettings.setFontsFolder(“fonts/cjk/dejavu-fonts-ttf-2.33/ttf”,
false);

ClassLoader classLoader = getClass().getClassLoader();
Document doc = new Document("data/asianFonts.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();

doc.save("/tmp/asianFonts.pdf", saveOptions);

Any suggestion?

Thanks in advance.

Hi there,

Thanks for your inquiry. I have tested the scenario using latest version of Aspose.Words for Java 15.7.0 and have not found the shared issue. Please use Aspose.Words for Java 15.7.0. I have attached the output document with this post for your kind reference.

The output looks good, let me try to upgrade aspose version.

Thanks a lot!

BTW, we are also seeing all the default fonts set to new roman, our other fonts settings were lost. Do you think that will be solved with the newer version of aspose word?

Thanks again.

For some reason, I still can’t get it work. Please check my testing project attached in asianFont.zip. I tried in JDK8 with aspose-words-15.7.0-jdk16.jar. Input and output files are all in the same directory. asianFonts.docx is my input, asianFonts.pdf is my output.

Thank you very much.

Hi there,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed - page formats( * JPEG, PDF or XPS * ).Make sure you have all the Fonts installed on your machine you’re using to convert Word document to Pdf format. Please read the following article:
https://docs.aspose.com/words/java/using-truetype-fonts/

Moreover, I suggest you
please read following documentation about getting notification of missing fonts. Hope this helps you.
https://docs.aspose.com/words/java/manipulate-and-substitute-truetype-fonts/

Thanks! The information is very useful.

I tested my doc, noticed that I have a lot of missing fonts, and it failed over to “Times New Roman”.

I am wondering where did you get those east asian fonts. The one I have seems not good enough. It will be great if you could send us some font vendors that you are using.

Thanks again!

Hi there,

Thanks for your inquiry. I used the fonts from Windows\Fonts directory. I tested the scenario at Windows 7. If you are working at Linux operating system, please read following link for your kind reference.
https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/