python-scripts/scripts/extract_text_from_pdf/script.py

7 lines
214 B
Python
Raw Normal View History

2022-10-02 17:16:10 +00:00
import PyPDF2
pdfFileObject = open('sample.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObject)
count = pdfReader.numPages
for i in range(count):
page = pdfReader.getPage(i)
print(page.extractText())