iospdfcgpdf

Extracting font data with CGPDFScanner


I'm using CGPDFScannerto scan PDF. When the scanner encounters something like:

BT
/F13 12 Tf 288 720 Td (ABC) Tj
ET

I use operator callbacks to extract the Tf, Td and Tj data. How do I extract /F13?


Solution

  • It's a name, a special form of string, usually used as dictionary keys. You can pop it with CGPDFScannerPopName. The information about the actual font is contained in the page's Resources dictionary, which contains a Font dictionary.