parsingpdffontscgpdfcgpdfscanner

Parsing PDF font operator missing


I'm parsing a PDF file and it seems that a Tf operator is missing. I can see, on PDF readers like Acrobat reader or Preview, that the font changes. But during the parse I don't have the Tf operator. I still have the ET operator that marks the ending of the previous text block and BT operator for the beginning of the new one. I also have text showing operator Tj & co.

Just to be clear, I do have Tf operators, but just in one place it should be there, it isn't.

The PDF reference states :

There is no initial value for either font or size; they must be specified explicitly by using Tf before any text is shown.

I don't understand why if I don't have Tf operator, how those readers can render the text correctly ?

Does someone know where the problem could come from ?


Solution

  • AFAIK text state is part of graphics state so if you have a Q operator somewhere there then that would explain the font changing (it would restore the state saved by previous q operator).

    Also, the graphics state operator gs could cause the change of font.