We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Fallback/default font not working when saving to PDF

I am using this example here: https://docs.aspose.com/words/net/specify-default-fonts/ and the attached docx file. No matter what I set the ‘DefaultFontName’ to, the output PDF always has Times New Roman. How do I actually set a fallback/default font for when the embedded font in the docx can’t be used?file.docx (382.8 KB)

Using Aspose.Words version 20.7.0.0

@rhrufftx

We have logged this problem in our issue tracking system as WORDSNET-22672. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@rhrufftx

It is to inform you that we have closed the issue WORDSNET-22672 as ‘Not a Bug’. The FontInfo substitution rule overrides the default font substitution rule. For more detail about font availability and substitution, please read the following article.

You can use following code example to achieve your requirement.

Document doc = new Document(MyDir + "input.docx");
FontSettings fontSettings = new FontSettings();

fontSettings.SubstitutionSettings.FontInfoSubstitution.Enabled = true;
fontSettings.SubstitutionSettings.TableSubstitution.AddSubstitutes("Helvetica Neue Light", new[] { "Arial" });
doc.FontSettings = fontSettings;

doc.Save(MyDir + "21.9.pdf");