text: import io
  from pdfminer.converter import TextConverter
  from pdfminer.pdfinterp import PDFPageInterpreter
  from pdfminer.pdfinterp import PDFResourceManager
  from pdfminer.pdfpage import PDFPage
  
  
  def extract_text_from_pdf(pdf_path):
      resource_manager = PDFResourceManager()
      fake_file_handle = io.StringIO()
      converter = TextConverter(resource_manager, fake_file_handle)
      page_interpreter = PDFPageInterpreter(resource_manager, converter)
      for page in PDFPage.get_pages(pdf_path, caching=True, check_extractable=True):
          page_interpreter.process_page(page)
  
      text = fake_file_handle.getvalue()
  
      converter.close()
      fake_file_handle.close()
  
      return text
  