Home
List the fonts a PDF uses with sumatrapdf-tool info -F, and save the embedded font files with sumatrapdf-tool extract.
Available in pre-release 3.7
Run sumatrapdf-tool extract file.pdf to save every embedded font (and image). At a glance:
  • List fonts: sumatrapdf-tool info -F file.pdf
  • Which fonts are embedded: Document Properties in SumatraPDF (Ctrl + D)
  • Save all fonts and images: sumatrapdf-tool extract file.pdf
  • Save one font: sumatrapdf-tool extract file.pdf <font descriptor number>
Use sumatrapdf-tool.exe, or SumatraPDF.exe with the same arguments.

List the fonts in a PDF #

sumatrapdf-tool info -F fonts.pdf
fonts.pdf:

PDF-1.7

Pages: 1

Retrieving info from pages 1-1...
Fonts (3):
	1	(12 0 R):	TrueType "Georgia" WinAnsiEncoding (3 0 R)
	1	(12 0 R):	TrueType "Consolas" WinAnsiEncoding (6 0 R)
	1	(12 0 R):	Type1 "Helvetica" WinAnsiEncoding (9 0 R)
Each line is: page number, the page’s object, font type, font name, encoding and the font’s object number.
  • A name like EASOZS+Times-Roman (6 letters and +) is a subset: only the characters used in the document are embedded.
  • info doesn’t say whether a font is embedded. In SumatraPDF, open the PDF and press Ctrl + D (File → Properties). The Fonts: list at the bottom marks embedded fonts, e.g. Georgia (TrueType; Ansi; embedded).
Add a page list to see the fonts of some pages only: sumatrapdf-tool info -F file.pdf 2-3.

Save all embedded fonts #

sumatrapdf-tool extract fonts.pdf
extracting font-0005.ttf
extracting font-0008.ttf
  • Files are written to the current folder, not the folder of the PDF.
  • extract also saves all images (image-0003.png, …). See Extract images from a PDF.
  • Fonts that aren’t embedded (like Helvetica above) are skipped: there is no font file in the PDF.
  • Existing files with the same name are overwritten.
The file name is font-<number>.<ext>. The number is the object number of the font’s descriptor, padded to 4 digits. The extension is the font format:
Extension Font format
.ttf TrueType
.cff Type 1 font in CFF (compact) form
.cid CID font in CFF form
.otf OpenType
.pfa Type 1
For example, a PDF made by groff has its Type 1 fonts stored as CFF:
extracting font-0008.cff
extracting font-0010.cff
extracting font-0012.cff
extracting font-0014.cff
extracting font-0016.cff

Save one font #

extract takes the object number of the font’s descriptor, which is not the number info -F shows. To find it, show the font object from info -F (here 3) with sumatrapdf-tool show:
sumatrapdf-tool show fonts.pdf 3
The output contains a line like /FontDescriptor 5 0 R. Extract object 5:
sumatrapdf-tool extract fonts.pdf 5
extracting font-0005.ttf
Note: sumatrapdf-tool extract fonts.pdf 3 (the number from info -F) saves nothing and reports no error.

When extract finds no fonts #

Some PDFs (for example, one made with Microsoft Print to PDF) keep the font descriptor inside the font object instead of as a separate object. extract doesn’t see those fonts and saves nothing. Save the font data with show instead:
  1. Show the font object from info -F:
   sumatrapdf-tool show lorem.pdf 11
  1. Find the font file in the output, e.g. /FontFile2 8 0 R (FontFile2 is TrueType, FontFile3 is CFF or OpenType, FontFile is Type 1).
  2. Save that object’s data:
   sumatrapdf-tool show -b -o font.ttf lorem.pdf 8
-b writes the decompressed stream data only, which is the font file.

Tips #

  • Subset fonts contain only the characters used in the document; they are not complete fonts.
  • A .cff or .cid file is bare font data; Windows can’t install it without converting it first.
  • Check the font’s license before you reuse it; embedding a font in a PDF doesn’t make it free to use.
  • To extract fonts from many PDFs, see Process many PDFs at once.

See also #