Q: Attached is a PDF that contains an usual PDF font - which is missing the embedded font. We have noticed inconsistent handling of the file by our software depending on the computers setup, some machines display the PDF properly, some substitute a similar font, and some others seem to choose a completely unrelated font like ‘Webdings’.
Some of the machines that display this file properly do have the documents font (Kozuka Gothic Pr6N) installed, while others that do not have this font installed also seem to display the file correctly.
When opened in Adobe Acrobat, users are prompted to download a special font package to view the document. Downloading this font package does not seem to affect how our software will display the document.
Can you provide us with any insight as to where PDFtron pulls fonts from what it will default to when a document’s font is not located? How can we better handle situations like this in the future?
A: The fact that ISO PDF allows missing fonts is a cause of lots of errors and confusion and is a big hole in PDF standard. Newer formats, such as PDF/A and XPS, require that all fonts are embedded.
If fonts are not embedded, PDFNet will attempt to use the closest matching font which fits PDF font descriptor. On Windows platforms, the fonts will be obtained from System fonts directory (e.g. C:\Windows\Fonts).
In order to use third party fonts/font collections with PDFNet SDK, you can either:
- Install the font as a system-wide font available for all applications, or
- Use custom font substitution by specifying the mappings to PDFNet SDK.
To use custom font substitution, you will need to use the PDFNet.AddFontSubst method(s). By using the PDFNet.AddFontSubst(), you can create custom mappings that can ovveride default PDFNet font subsitution.
For example, you could add a mapping from ‘Kozuka Gothic Pr6N’ to the location of ‘standard’ Acrobat font folders (e.g. ‘C:\Program Files (x86)\Adobe\Acrobat 10.0\Resource\CIDFont\KozMinPr6N-Regular.otf’).
The following are some relevant links: