Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created September 10, 2022 18:19
Show Gist options
  • Select an option

  • Save samirsaci/44478c5f1cff95b3a99eb9a7c77a9358 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/44478c5f1cff95b3a99eb9a7c77a9358 to your computer and use it in GitHub Desktop.
Productivity
import PyPDF2
# Open the report
pdfFileObj = open('example.pdf', 'rb')
# Launch pdf reader object
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
# number of pages in pdf
n_pages = pdfReader.numPages)
Texts = []
for p in range(n_pages):
# Open the page
pageObj = pdfReader.getPage(p)
# Add the text in your list
Texts.append(pageObj.extractText())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment