title: Understanding PDF operators - for iOS app
body: <p>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 would like to clarify:</p>
  
  <ul>
  <li>The <code>Tm</code> operator is used as the starting point of each line. (Is my understanding correct?)</li>
  <li><p>If the <code>Tm</code> operator is the starting point of every line, how can I parse the text shown <em>only</em> within the specified <code>Tm</code>? e.g.:</p>
  
  <pre><code> BT
      0 0 1 rg
      /Ti 12 Tf
      1 0 0 1 100 100 Tm
      0 0 Td
      (The quick brown fox ) Tj 0 −13 Td
      (ate the lazy mouse.) Tj
   ET
   //I only want to get the Tj and TJ string being positioned by the Tm
  </code></pre></li>
  <li><p>I understand that every 1000 units of a glyph's height and width is equivalent to 1 unit of text space. So if the glyph width is 2000 and it's height is 1060, does that mean that the "real" width and height of it is 2 and 1.06 respectively?</p></li>
  </ul>
  
  <p>Now I know that some of these questions sound outright stupid, but I really don't have much time to research. So if anyone can help me understand this, it will be definitely appreciated.</p>
  
  <p><strong>NOTE</strong>: The pdf reader app must contain search and highlight function, text selection, notes, bookmark, etc. Practically all the basic stuff you can find in almost every reader available nowadays. I will probably use a third-party library for this to make my life easier, but my biggest problem will be the Text selection function. So I really need to understand this.</p>