Skip to content

Instantly share code, notes, and snippets.

@Lakshmi-1212
Created June 7, 2022 06:53
Show Gist options
  • Save Lakshmi-1212/44f3edc1bcc57a5e15dc8c3acdcda005 to your computer and use it in GitHub Desktop.
Save Lakshmi-1212/44f3edc1bcc57a5e15dc8c3acdcda005 to your computer and use it in GitHub Desktop.
def read_file_pypdf(filepath):
pdfFileObj = open(filepath,'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
num_pages = pdfReader.numPages
text = ""
# Read all the pages
for pg in range(num_pages):
page = pdfReader.getPage(pg)
text += page.extractText()
return text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment