PDFTron built-in office conversion: font requirements

This article concerns PDFTron’s new built-in .docx conversion engine, as accessed through the methods Convert.WordToPDF() and Convert.WordToPDFConversion(). It does not apply to office conversions performed through Microsoft Word interop.

Question: How do I ensure that the built-in office converter has the font data it needs to convert .docx files to PDF?

Short answer:

On a windows PC or server: you probably don’t need to do anything.
On a Mac or Linux PC or server: you don’t need to do anything, but can improve the conversion results by providing some extra font resources.
On a mobile system: you will need to specify the location of some form of font resource (these are included in the SDK package).


Long answer:

On Microsoft Windows systems, the converter will attempt to make use of any fonts installed on the system. Windows systems usually have most of the fonts encountered in a typical Word document. On other systems, these fonts (or alternatives) can be provided via some other means, as described below.

1) User-provided .docx resource document (optional): The converter can produce good results with no user-supplied fonts at all, but for the highest conversion quality, fonts can be provided in a .docx resource document. This document must be named “pdftron_convert_resources.docx” and can reside in either in the resource directory (use PDFNet.SetResourcesPath() to set this value), or at some arbitrary location, specified in the conversion options. The file should have all the required fonts embedded within it (you can create a file like this by checking the “embed fonts in the file” option from the “Save” preferences within Word )

2) pdftron-provided fallback font data (required): If no appropriate fonts are found on the system or in a resource .docx, then the converter will need to use it’s own fallback font data. On Mac, Linux, or Windows this data is built into the library and will be automatically used. On mobile systems (such as Android) the data is not part of the binary, but is included in the SDK package as a separate resource file: “pdftron_layout_resources.plugin”. This file can either be placed in the resource directory (set via PDFNet.SetResourcesPath()), or in some arbitrary location, specified in the conversion options.


Font Embedding

When the conversion routine is able to find a matching font, it will embed that font in the resulting .pdf. Otherwise, the converter will attempt to embed one of the PDF base 14 fonts if there is a close enough match, and failing that, will not embed the font at all.

Smart embedding: Using pdftron-supplied smart substitution data, the conversion routine can produce .pdf documents with fully embedded fonts that are a close match to the originals. To enable this option, either place the file “pdftron_smart_substitution.plugin” (included in the SDK download) in the resource directory (set via PDFNet.SetResourcesPath()), or specify it’s path directly in the conversion options.