embed_fonts
Automatically locate and embed missing system fonts
Usage
pdftl
<input>embed_fonts[<spec>...][output<output>]
Details
The embed_fonts operation automatically locates and embeds missing fonts. It scans
the PDF for any font definitions (including Standard 14 BaseFonts like Helvetica or
Arial) that lack an embedded binary stream.
When an unembedded font is found, the operation searches the host operating system’s
font directories (and any custom directories provided) to find a matching .ttf,
.otf, or .pfb file. If a match is found, the font is read into memory and
injected directly into the PDF.
If the original PDF font lacked a /FontDescriptor entirely, the operation leverages
fontTools to dynamically extract accurate typography metrics from the located binary
and constructs a compliant descriptor from scratch before embedding it.
Arguments
[page_range]: Optional page ranges to limit the scope of the font scanning.[fontdir <dir>]: Optional custom directory to search for font files. Can be specified multiple times.[nosys]: If provided, skips searching the host operating system’s standard font directories, strictly relying on providedfontdirpaths.[rename]: If provided, renames the PDF’s internal/BaseFontand/FontNamestructures to match the true name of the injected font binary.
Examples
Scan the entire document and embed any missing fonts using system equivalents.
pdftl in.pdf embed_fonts output out.pdf
(“Scan only pages 1 through 5, explicitly looking for missing fonts only in ‘/brand/assets’ and ignoring system fonts.”,)
pdftl in.pdf embed_fonts 1-5 fontdir /brand/assets nosys output out.pdf
Tags: in_place, fonts, embed, repair
Source: pdftl.operations.embed_fonts
Read online: https://pdftl.readthedocs.io/en/stable/operations/embed_fonts.html
Type: Operation