title: PDF to text in Python returning empty results in image files
body: <p>I've got this <a href="https://drive.google.com/file/d/1DTGkr1ltsgMDChYVgb8KSCWYbgcQFPVV/view?usp=sharing" rel="nofollow noreferrer">pdf file</a>. Image based low resolution pdf file. I'm trying to extract the data in it and all options I've tried seem not to work.</p>
  <p><strong>Option 1 - using pdfminer</strong></p>
  <pre><code>from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
  from pdfminer.converter import TextConverter
  from pdfminer.layout import LAParams
  from pdfminer.pdfpage import PDFPage
  from io import StringIO
  
  def convert_pdf_to_txt(path):
      rsrcmgr = PDFResourceManager()
      retstr = StringIO()
      codec = 'utf-8'
      laparams = LAParams()
      device = TextConverter(rsrcmgr, retstr, laparams=laparams)
      fp = open(path, 'rb')
      interpreter = PDFPageInterpreter(rsrcmgr, device)
      password = &quot;&quot;
      maxpages = 0
      caching = True
      pagenos=set()
  
      for page in PDFPage.get_pages(fp, pagenos, maxpages=maxpages, password=password,caching=caching, check_extractable=True):
          interpreter.process_page(page)
  
      text = retstr.getvalue()
  
      fp.close()
      device.close()
      retstr.close()
      return text
  </code></pre>
  <p><strong>Option 2 - using tika</strong></p>
  <pre><code>from tika import parser # pip install tika
  raw = parser.from_file(path)
  text=raw['content']
  # I don't like to use it very much because it often corrupts the file
  </code></pre>
  <p><strong>Option 3 - using pypdf</strong></p>
  <pre><code>    import PyPDF2
      pdf_file = open(path, 'rb')
      read_pdf = PyPDF2.PdfFileReader(pdf_file)
      number_of_pages = read_pdf.getNumPages()
      page = read_pdf.getPage(0)
      page_content = page.extractText()
      text=page_content.encode('utf-8')
  </code></pre>
  <p>All the options return empty results. I suppose it might be related to the quality of the file.
  I know we could work on images and increase image characteristics to ease the data extraction (increase image size, work on thresholds, etc, you can do a lot of stuff with PIL). Is there an efficient way to also do that with pdf files?</p>