Quite rarely, you might have experienced font substitution when using custom true type fonts with Word Layouts and generating PDF files with the embedded functionality.
This affects both web client and windows client and any supported version of Dynamics NAV and Business Central that implements Word Layouts.
This is the typical scenario
- Generating Word files from Word Layout and then converting to PDF: OK
- Printing to PDF printer from Word: OK
- Generating PDF files from RDL Layout: OK
- Generate PDF files from Word layout: applies font substitution.
Below a typical example of fonts substitutions: how it should look like
and how it results after generating PDF from Word Layout with a visible font substitution
This is quite rare to happen and it is due to a 3rd party component (Aspose) that performs the transformation of the word document into PDF.
The Aspose component has to perform a very exotic conversion from word to pdf, within these rare contexts, and applies Font Substitution trying matching the appropriate glyph looking into local machine registry. This is happening when there is a definition of the font within the word document and not the font stored itself.
What is the easy solution, then, within this very rare and specific scenario? Embed fonts in the Word document directly.
How to achieve this:
- Take your docx file template from your extension or from the custom report layout selection page (export layout)
- Open docx file with MS Word
- Once the document is open go to File > Options
- Choose “Save” tab in the Options Form
- Check the options “Embeds fonts in file” and “Do not embed common system fonts” as per the following (NOTE: Sales – Invoice.docx is just an example)
- Save the document and close MS Word
- Use that docx file in your extension or as template in the custom report layout selection page (import layout)
This will resolve the issue that you have when generating PDF files from word document layouts since the template document will store fonts (embed) and these will be reused directly as is in the pdf conversion process.