18

Is there a way to extract fonts from PDF files?

I know that usually embedded fonts in PDF files are only subsets of the fonts. Anyway, is there a way to do this?

slhck
  • 235,242

3 Answers3

3

Here I'm promoting my earlier comment to an answer, as per HackSlash's suggestion.

There is an identical question on Stackoverflow that already has an excellent and highly upvoted accepted answer.

It illustrated several methods, which I'll only list briefly:

  1. pdftops
  2. fontforge
  3. mupdf
  4. a ghostscript script
  5. pdf-parser.py

In addition, I'd like to point out that there are several free online services that offer to do just that.

Comment: I am not going to "choose the best option" since best is often subjective and really dependent on the specific situation. Easiest of all would be to use an online service, but that would not be a viable option if the material was to remain private. FontForge looks really good especially for those who might already be using it for font creation or editing. If no desktop environment is available then pdftops (and the other command-line options), would be a good choice also good for automation.

simlev
  • 3,912
1

I would use Font Forge because it is a free, open-source, and cross-platform, solution that can extract font data from PDF files.

https://fontforge.github.io/en-US/

Use the File > Open menu item.

FROM THE DOCUMENTATION:

FontForge can also read (many) fonts out of a pdf file. FontForge usually does not list pdf files (because they aren't really designed as mechanisms for transporting fonts and most such fonts will be incomplete due to subsetting and other optimizations), but you can always type in the name of one directly (or use the [Filter] button to define a filter for pdf files).

https://fontforge.github.io/filemenu.html

HackSlash
  • 5,015
0

Note that depending on the source program and author they may have chosen to "convert fonts to outlines" in which case the actual live font data isn't embedded. This was often necessary back in the days of Postscript output and the practice is still held over today even though it's not really necessary.

cf. https://graphicdesign.stackexchange.com/questions/55780/is-it-necessary-to-outline-fonts-convert-text-to-curves-before-sending-them-to