I’m having the same problem, please, what should I do, thanks!
@yjsdfsdf Could you please attach your problematic input and output documents here for testing? We will check the issue and provide you more information.
I use aspose word to convert doc to PDF, the code is as follows
com.aspose.words.Document document = new com.aspose.words.Document("C:\\Users\\季度报告.doc");
document.save("C:\\Users\\aa.pdf");
When I’m on a windows computer, the bolded Song font in the document can be converted, but on Linux, which also has Song installed, the bolded Song font becomes Simsun-bold!
新建文件夹.zip (528.7 KB)
Any thoughts on this please, thanks!
@yjsdfsdf Unfortunately, I cannot reproduce the problem on my side. I have tested the following code for testing:
Document doc = new Document("/temp/in.doc");
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{new SystemFontSource(), new FolderFontSource("/temp/fonts", true)});
doc.save("/temp/out.pdf");
The following fonts from widows are copied into /temp/fonts
folder:
- SimSun (TTC)
- Calibri (TFF whole family)
- Times New Roman(TFF whole family)
And here is the output produced on my side: out.pdf (217.3 KB)
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/
If Aspose.Words cannot find the fonts used in the document the fonts are substituted. You can implement IWarningCallback to get a notification when font substitution is performed.
I found a situation, not sure if it’s relevant, if the Linux system is Red Hat Enterprise Linux Server release, it’s a problem, I’m on Centos Linux release, it’s just fine!
@yjsdfsdf Have you tried putting the same fonts into a folder and use this folder as a font source in both your environments? The result of rendering should be the same is the same fonts are used.
I tried but it still doesn’t work, I don’t know what I’m missing with this server ( Red Hat Enterprise Linux Server release), any suggestions?
can you test on a server with Red Hat Enterprise Linux Server release 7.6 (Maipo)?
It looks like it’s a font problem, but I don’t know what’s wrong with the fonts on the servers that are having issues
@yjsdfsdf Could you please attach the fonts from your Red Hat environment? We will check conversion using the provided fonts on our side.
I can’t upload the font file because it’s too big, I get a warning “that file is too big (maximum size is 48.8 MB)”. Here is the result of “fc-list” command.
font-list.zip (8.2 KB)
I see, if Linux has the SimSunBold font it causes that problem, that is the bolded simsun font becomes the SimSunBold.
@yjsdfsdf Thank you for additional information. The problem might be in the version of the font used in your Red Hat environment.
You can upload big files to google drive and share a link here. On my side there is no separate file for SimSunBold font, since SimSun is a single TTC file on my side, i.e. TrueType Collection, which contains all font styles.