title: Issues with PyMuPDF extracting plain text
body: <p>I want to read in a PDF file using <a href="http://pymupdf.readthedocs.io/en/latest/#" rel="nofollow noreferrer">PyMuPDF</a>. All I need is plain text (no need to extract info on color, fonts, tables etc.).</p>
  
  <p>I have tried the following</p>
  
  <pre><code>import fitz
  from fitz import TextPage
  ifile = "C:\\user\\docs\\aPDFfile.pdf"
  doc = TextPage(ifile)
  &gt;&gt;&gt; TypeError: in method 'new_TextPage', argument 1 of type 'struct fz_rect_s *'
  </code></pre>
  
  <p>Which doesn't work, so then I tried</p>
  
  <pre><code>doc = fitz.Document(ifile)
  t = TextPage.extractText(doc)
  &gt;&gt;&gt; AttributeError: 'Document' object has no attribute '_extractText'
  </code></pre>
  
  <p>which again doesn't work.</p>
  
  <p>Then I found a <a href="http://code.activestate.com/recipes/580626-pdf-text-extraction-using-fitz-mupdf-pymupdf/" rel="nofollow noreferrer">great blog</a> from one of the authors of PyMuPDF which has detailed code on extracting text <strong>in the order it is read</strong> from the file. But everytime I run this code with a different PDF I get <code>KeyError: 'lines'</code> (line 81 in the code) or <code>KeyError: "bbox"</code> (line 60 in the code).</p>
  
  <p>I can't post the PDF's here because they are confidential, and I appreciate that would be useful information to have here. But is there any way I can just do the simplest task which PyMuPDF is meant to do: <strong>extract plain text from a PDF, un-ordered or otherwise</strong> (I don't mind much)?</p>