Skip to content

Instantly share code, notes, and snippets.

@haider11234
Created January 11, 2021 05:57
Show Gist options
  • Save haider11234/6b4c01bb0a005d2d0360acbd6bf8258d to your computer and use it in GitHub Desktop.
Save haider11234/6b4c01bb0a005d2d0360acbd6bf8258d to your computer and use it in GitHub Desktop.
# importing modules
import PyPDF2
pdfFileObj = open('file.pdf', 'rb')
# creating a pdf reader object
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
# creating a page object
pageObj = pdfReader.getPage(0)
# extracting text from page
print(pageObj.extractText())
pdfFileObj.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment