Ask Geoff: space used by fonts embedded in PDFs

I get e-mails now and then about typography related things, so I figured I would try putting my responses (or revised versions) here for general reference.

Is there a way to determine how much each particular font embedded in a PDF file contributes to the file's size?

There are a few tools that will tell you information about fonts in a PDF. The pdffonts, which is part of xpdf, seems like the most informative but it does not tell you about how much space an embedded font uses up. Acrobat Reader will also tell you a little bit about the fonts that are embedded in a PDF, but again I couldn't find anything about space used. Even the profession version did not seem offer this information, which seems kind of strange given the various optimization tools it provides.

pdffonts does tell you the object number of each font in the PDF, so if you could extract a specific object from a PDF it would be possible to write wrapper that would tell you how much space the embedded fonts are using. However, I spent a few minutes investigating and did not find any really easy simple way to extract PDF objects. By really easy I mean by a command-line tool. I have to imagine that there is probably something in CPAN that has an API for extracting PDF objects. There is pdftosrc, part of most modern TeX distributions, that will extract PDF »stream objects«, but these seem to be different than just plain »objects«.

2 Comments »

  1. George said,

    June 27, 2007 @ 1:03 am

    Thanks for addressing this useful issue. I have been trying to figure out how to get this info too, for a while now. I haven’t been able to find direct display of each INDIVIDUAL FONT information, but in cases where it is important for some reason, there is a workaround.

    The closest I think you can get to the info about embedded fonts used in a file in Acrobat Professional 8 (but all the fonts together, not each separate one) is by going to menu Advanced > PDF Optimizer, and when the dialog box displays, clicking on “Audit space usage” (a button on top right of the dialog box). This will NOT display info for individual fonts, but if you are curious about a particular font, you could use the same dialog box’s tab “FONTS”, and un-embed one font, and then run optimize command (I’d suggest saving PDF w/ a new file name); when the file is saved, run the same “Audit space usage” again. The difference in space assigned to fonts in this new file, will be the space previously occupied by the one font you removed.

    Now, I realize this convoluted process may be viable if you need to know the size of one font; not a good solution to have a detailed break-down of, say, 20+ fonts in 30 files…

  2. washburn said,

    June 29, 2007 @ 10:07 am

    Thanks, this is useful to know!

RSS feed for comments on this post · TrackBack URI

Leave a Comment