Aspose word 19.5(Soucre Pro Sans Font issue)

We are using Aspose.Words for java v19.5. We are trying to save the document which is having “Source Sans Pro” font into PDF, but the generated pdf document is not retaining the “San Pro” font instead replacing with “Arial” font.

Even after installing the font into local system the pdf is not using “Source Sans Pro” font.

Please help us to resolve this issue.

@ashokramakr Could you please attach your input and output document and the problematic Source Sans Pro font here for testing? We will check the issue and provide you more information.

Out_Test_Sans_Pro.pdf (23.9 KB)

out_Test_Sans_Pro.docx (25.8 KB)

Source_Test_Sans.docx (28.6 KB)

@ashokramakr Thank you for additional information. Could you please also attach the problematic Source Sans Pro font here for testing? This font is not available on my side and is substituted as in your output.

source-sans-pro (1).zip (731.3 KB)

@ashokramakr Unfortunately, the problem is not reproducible on my side. I have put the "Source Sans Pro" fonts into a separate folder and used this folder as an additional font source. here is code used for testing:

Document doc = new Document("C:\\Temp\\in.docx");
doc.setFontSettings(new FontSettings());
// "C:\Temp\fonts" folder contains "Source Sans Pro" fonts
doc.getFontSettings().setFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource("C:\\Temp\\fonts", true) });
doc.save("C:\\Temp\\out.pdf");

And here is the output document: out.pdf (18.5 KB)

Most likely the problem on your side occurs because fonts required for document rendering are not available in your environment. If Aspose.Words cannot find the fonts used in the document the fonts are substituted . This might lead into the layout and appearance difference. You can implement IWarningCallback to get a notification when font substitution is performed.
The following articles can be useful for you:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/

Can you share the version which was used to generate pdf file.

@ashokramakr The latest 23.10 version of Aspose.Words for Java has been used for testing.

Version 19.5 will work right ?

@ashokramakr Yes, I have re-tested conversion with old 19.5 version using the above code and the result is the same: out.pdf (17.5 KB)

Thanks your reply

1 Like