I use the InputStream and ByteArrayOutputStream to convert word to pdf, some Chinese fonts have changed

As the title, I use the InputStream and ByteArrayOutputStream to convert word to pdf, some Chinese fonts have been changed.
1658477972598.png (38.8 KB)
1658478164158.png (52.7 KB)
Just like this, even fonts in the same format will become different formats after conversion.How should I solve this problem?
My usage is as follows:

ByteArrayOutputStream out = new ByteArrayOutputStream();
Document doc = new Document(InputStream);
doc.save(out, SaveFormat.PDF);

The development environment is windows and the production environment is linux.Is there a difference in the solution depending on the operating system? I look forward to your answer and appreciate it!

@sensei Could you please attach your problematic document and output here for testing? Also could you please attach font files if they are not included into Windows or Office. We will check the issue and provide you more information.
Also please check the Install TrueType Fonts on Linux and Specify TrueType Fonts Location articles as the problem may be related to the fact that required fonts are not available to Aspose.Words.

The version I use is aspose-words-15.8.0 and the language is JAVA.

@sensei You are using quite old version of Aspose.Words. Please try using the latest 22.7 version of Aspose.Words for Java.
Also, to analyze the issue, we need your real input MS Word documents and output PDF documents. Without these resources it is impossible to tell you what the problem is.

系统性能优化汇报word.docx (12.2 KB)
The file before conversion.
系统性能优化汇报pdf.pdf (51.1 KB)
The file after conversion.

This is the online link to the font files zip:https://pan.baidu.com/s/1-xpwl7txyqztpuprsxom6a?pwd=r2s4

@sensei Unfortunately I cannot reproduce this issue on my side (please check output from my side test.awjava.22.7.pdf (33.9 KB)).

The problem on your side is probably related to the fact that Aspose.Words do not have access to the required fonts (“SimSun” font particularly). Please update Aspose.Words for Java to the latest 22.7 version and provide the required font files to Aspose.Words. Please feel free to contact us if you will still be facing this issue.

I added some more fonts to the Linux server, including the “SimSun” font, and now the problem is solved. I will contact you again if there is still a problem with abnormal fonts after conversion, thank you very much for your answer and help.

2 Likes