I am tasked to create a pdf reader app for our company. After a few research, I became confused with the different operators inside the PDF. Here are a few things that I wou
You'll need to familiarize yourself with the PDF specification, the annex A contains a summary of all the operators with links to more detailed documentation about the parameters, so that may be a good starting point.
The Tm
operator doesn't necessarily set the starting point of each line, it generally sets the text matrix, which is basically equivalent to a CGAffineTransform
in terms of Quartz2D. To move to the next line, a document could also use the Td
, TD
, "
or T*
operators. PDF documents don't necessarily draw their text in the order that appears on screen, they may move around on the page freely and position the glyphs in any order they see fit. PDF doesn't really have the concept of a "line", you'll have to infer those from the position of the glyphs yourself (which can be tricky for things like subscript/superscript).