Skip to Content

Substituting fonts

Estimated Reading Time: 1 Minutes

Datalogics added a method to Adobe PDF Library v18.0.3PlusP1e (November 4, 2020) called PDDocReplaceUnembeddedSimpleFonts(). This method, declared in the header file DLExtrasCalls.h, allows you to replace an unembedded simple font (Type 1, TrueType, and OpenType, not OCF) referenced in a PDF document with a different font. The fonts are identified by name and can be selected as long as you have installed the fonts you want to use in a standard folder location on your system where Adobe PDF Library can find them. Provide the name or names of the fonts currently in the document (Tahoma,Bold Times New Roman) that you want to replace with the name or names of fonts to use to replace them (Cambria,Bold Arial). Then, provide the number of fonts to be replaced (in this example, 2).

Be careful when you choose a new font to replace an existing font referenced by a PDF document. The fonts need to be similar to avoid causing problems in the resulting output file. If the new font you use does not match the original in terms of encoding, metrics, and glyphs, the resulting PDF file could be invalid in a variety of ways.

Note:  This call permanently changes the name of the font in the PDF document. So the document should not be saved after this call, unless you want this change to be applied to the document contents.

Substituting fonts
  • COMMENT

  • Get notified when new articles are added to our knowledge base.