python-scripts/scripts/extract_text_from_pdf/script.py
2022-10-02 22:46:10 +05:30

7 lines
214 B
Python

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())