tags:

views:

340

answers:

1

I have been playing about with iText to try get a list of embedded fonts used in an external PDF. Am i missing something or is this just not very well documented? Could anyone explain it to me or suggest an alternative? Preferable the font names and any associated data.

A: 

What have you tried? Fonts are generally captured in the dictionary associated with each page, so if you grab the page dictionary, then look for a sub-dictionary for the font, etc... you'll find it.

If you have the latest version of iText (HEAD from SVN), take a look at the text parser. There's a tool in there that, in addition to dumping the text on the page, also dumps the dictionary structure, including font info.

If the discussion of 'dictionary', etc... isn't clear, you will probably need to start with at least a brief reading of the PDF spec (Adobe has it on their site). You probably won't find a method in iText for obtaining the fonts from a page - but you can get the dictionaries, and in PDF, the dictionary defines everything (including fonts)

Kevin Day
Thanks, i wasn't aware the dictionary would have sub-dictionary's. I didnt bother with the latest version, i dont need that functionality for the time being
AphexMunky