Created
December 6, 2021 12:12
-
-
Save keitazoumana/6b642dc9541eceeba10be1b375ba1ee9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyPDF2 import PdfFileReader | |
# creating a pdf file object | |
pdfObject = open('./data/obama-worlds-matter.pdf', 'rb') | |
# creating a pdf reader object | |
pdfReader = PdfFileReader(pdfObject) | |
# Extract and concatenate each page's content | |
text='' | |
for i in range(0,pdfReader.numPages): | |
# creating a page object | |
pageObject = pdfReader.getPage(i) | |
# extracting text from page | |
text += pageObject.extractText() | |
print(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment