title: How to select lines of text in a PDF and then highlight them? (iOS)
body: <p>I have searched for PDF annotation on Google, stackoverflow, and Apple's developer library but none of them really satisfies my need. Here is my problem and my current knowledge of it, please correct me if I'm wrong.</p>
  
  <p>I would like to allow users to first select some lines of text to highlight, and then draw highlighting rectangles on top them.</p>
  
  <p><strong>[Question]: How do we select text on a PDF page rendered by CGContextDrawPDFPage()?</strong>
  <em>Specifically, if I were to override the touchesBegan/Moved/Ended delegate methods, what should I do in there in order to track the text frame that a user wants to select?</em></p>
  
  <p>I don't want to use FastPDFKit because it displays a logo and costs money, or UIWebView because it is very limited in terms of things that we can do with it, plus I would like to learn how to do this myself :-)</p>
  
  <p>Thanks!
  Derek</p>
  
  <p><strong>-- UPDATE --</strong></p>
  
  <p>Potential solution: I could probably put a transparent view on top of my PDF, and while parsing the PDF content, build a rectangle for every Tj or every string element in TJ. Those rectangles would be the selectable "text" that users can highlight. One caveat is that some PDFs jam several words into one Tj, so that prevents users from selecting individual words in that case. I will try this approach and update the result later.</p>