code: def extract_tesseract(self, filename, **kwargs):
          
          temp_dir = mkdtemp()
          base = os.path.join(temp_dir, 'conv')
          contents = []
          try:
              stdout, _ = self.run(['pdftoppm', filename, base])
  
              for page in sorted(os.listdir(temp_dir)):
                  page_path = os.path.join(temp_dir, page)
                  page_content = TesseractParser().extract(page_path, **kwargs)
                  contents.append(page_content)
              return six.b('').join(contents)
          finally:
              shutil.rmtree(temp_dir)
docs: Extract text from pdfs using tesseract (per-page OCR).