title: Tesseract could not recognize text from a pdf file
body: <p>I tried to use <code>Tesseract</code> in <code>Python</code> to <code>OCR</code> some PDFs. The workflow is to convert a PDF to a series of images first using <code>wand</code>, then send them to <code>Tesseract</code> based on this <a href="https://pythontips.com/2016/02/25/ocr-on-pdf-files-using-python/" rel="nofollow noreferrer">example</a>. I applied this to 5 PDFs but found it failed to convert one (completely failed). It works fine to convert PDF to Tiff. Thus, I guess maybe something needs to be tuned in the OCR process? Or any other tools I should use to deal with this situation? I tried <code>xpdfbin-win-3.04</code> which worked on this PDF but did not work as well as <code>Tesseract</code> on the other PDFs...</p>
  
  <h3>Screenshot of failed PDF</h3>
  
  <p><a href="https://i.stack.imgur.com/c5YkI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c5YkI.png" alt="enter image description here"></a></p>
  
  <h3>Output text</h3>
  
  <p><a href="https://i.stack.imgur.com/GPVXJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GPVXJ.png" alt="enter image description here"></a></p>
  
  <h3>Code</h3>
  
  <p>from wand.image import Image
  from PIL import Image as PI
  import pyocr
  import pyocr.builders
  import io</p>
  
  <p>tool = pyocr.get_available_tools()[0]
  lang = tool.get_available_languages()<a href="https://i.stack.imgur.com/c5YkI.png" rel="nofollow noreferrer">2</a></p>
  
  <p>pth_str = "C:/Users/TH/Desktop/OCR_test/"
  fname_list = ["999437-Asb_1-34.pdf"]
  for each_file in fname_list:
      print each_file
      req_image = []
      final_text = []</p>
  
  <pre><code># convert to tiff
  image_pdf = Image(filename=pth_str+each_file, resolution=600)
  image_tif = image_pdf.convert('tiff')
  
  for img in image_tif.sequence:
      img_page = Image(image=img)
      req_image.append(img_page.make_blob('tiff'))
  
  # begin OCR
  for img in req_image: 
      txt = tool.image_to_string(
          PI.open(io.BytesIO(img)),
          lang=lang,
          builder=pyocr.builders.TextBuilder()
      )
      final_text.append(txt.encode('ascii','ignore'))
  </code></pre>