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

Free Support Forum - aspose.com

Saving Word file as PDF does not embed fonts

I have a Word file with a non-standard (paid) font. If I save in Word as PDF, the layout of the file is correct. However, when simply doing Save in .Net and passing it a PDF file name, the generated PDF is not correctly layouted. The font is replaced by Courier New which looks completely wrong. Why is there a difference in behaviour?
I also tried playing with the ‘Embed fonts’ property in Word: when setting this in Word, everyhting works fine (save in word or via aspose), but when setting this ‘Embed fonts’ property in aspose, the generated pdf is again wrong.
Is this a known bug or do I do something wrong?

@krifo Could you please attach your document and font here for testing? We will check the issue and provide you more information.

Please find attached the word file that is giving me problems. I also attached the saved PDF from Aspose.
Strange thing is that once I change something in the file and save it in Word, the save as pdf in Aspose works fine with correct fonts.

SourceFile.docx (64.4 KB)
SavedAsPDFWithAspose.pdf (125.8 KB)

@krifo Could you please also attach the font Flanders Art Sans used in your document? I will check the issue and provide you more information.
Note, it is safe to attach files in the forum, only you and Aspose staff can access your files.

Hi @alexey.noskov
Thanks for your question. I did not know only you could open the attachment, good to know, since the font is not a free and property of the Flemish government!
The font consists of 4 ttf files, I added them to a zip file, hope this helps
FlandersArtSans.zip (111.2 KB)

@krifo Thank you for additional information. I have tested the scenario on my side with the latest 22.1 version of Aspose.Words for .NET and the fonts are properly embedded into the output PDF.
Here is the code I used for testing:

Document doc = new Document(@"C:\Temp\SourceFile.docx");
doc.WarningCallback = new WarningCallback();
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] { new SystemFontSource(1), new FolderFontSource(@"C:\Temp\fonts", true, 2) });
private class WarningCallback : IWarningCallback
    public void Warning(WarningInfo info)
        if (info.WarningType == WarningType.FontSubstitution)

The fonts Flanders Art Sans where copied into C:\Temp\fonts folder, specified in the FolderFontSource.
In the console output I see only the following message:

Font 'Bliss Light' has not been found. Using 'Arial' font instead. Reason: font info substitution.

And in the output PDF I see the fonts are properly embedded.

This works indead.
I just have one more question concerning this issue: why do I have to embed the font when using your library? When I simply open the file in Word and save it as pdf, than the font is not embedded but it is replaced by a very similar font and not by Courier New.

@krifo When the font specified in the document is not available Aspose.Words tries to find an alternative applying a set of substitution rules. MS Word replaces the font with ‘Calibri’, but Aspose.Words with ‘Courier New’ while applying FontInfoSubstitution rule. To get the same result as MS Word produces you can use the following code (disable FontInfoSubstitution rule and set ‘Calibri’ as a default font in DefaultFontSubstitution rule)

Document doc = new Document(@"C:\Temp\SourceFile.docx");

doc.FontSettings = new FontSettings();
doc.FontSettings.SubstitutionSettings.FontInfoSubstitution.Enabled = false;
doc.FontSettings.SubstitutionSettings.DefaultFontSubstitution.DefaultFontName = "Calibri";


But please note that for proper and accurate rendering the fonts specified in the document must be available.

1 Like