code: def path_to_text(self, path):
          '''
          Transform local PDF file to string.
  
          Args:
              path:   path to PDF file.
  
          Returns:
              string.
  
          '''
          rsrcmgr = PDFResourceManager()
          retstr = StringIO()
          codec = 'utf-8'
          laparams = LAParams()
          device = TextConverter(rsrcmgr, retstr, codec=codec, laparams=laparams)
          fp = open(path, 'rb')
          interpreter = PDFPageInterpreter(rsrcmgr, device)
          password = ""
          maxpages = 0
          caching = True
          pagenos = set()
  
          pages_data = PDFPage.get_pages(
              fp,
              pagenos,
              maxpages=maxpages,
              password=password,
              caching=caching,
              check_extractable=True
          )
  
          for page in pages_data:
              interpreter.process_page(page)
  
          text = retstr.getvalue()
          text = text.replace("\n", "")
  
          fp.close()
          device.close()
          retstr.close()
          return texf path_to_text(self, path):
          '''
          Transform local PDF file to string.
  
          Args:
              path:   path to PDF file.
  
          Returns:
              string.
  
          '''
          rsrcmgr = PDFResourceManager()
          retstr = StringIO()
          codec = 'utf-8'
          laparams = LAParams()
          device = TextConverter(rsrcmgr, retstr, codec=codec, laparams=laparams)
          fp = open(path, 'rb')
          interpreter = PDFPageInterpreter(rsrcmgr, device)
          password = ""
          maxpages = 0
          caching = True
          pagenos = set()
  
          pages_data = PDFPage.get_pages(
              fp,
              pagenos,
              maxpages=maxpages,
              password=password,
              caching=caching,
              check_extractable=True
          )
  
          for page in pages_data:
              interpreter.process_page(page)
  
          text = retstr.getvalue()
          text = text.replace("\n", "")
  
          fp.close()
          device.close()
          retstr.close()
          return text
docs: Transform local PDF file to string.
  
          Args:
              path:   path to PDF file.
  
          Returns:
              string.