Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Python by (47.6k points)

Which are the best Python modules to convert PDF files into text?

1 Answer

0 votes
by (106k points)

You can use PDFMiner which is a Python module for converting PDF to text. You can use the below code to check the version of pdfminer.

import pdfminer

pdfminer.__version__

You can also use the pyPDF which also works fine. If you only want the text with spaces, you can use the following piece of code:-

import pyPdf

pdf = pyPdf.PdfFileReader(open(filename, "rb"))

for page in pdf.pages:

print(page.extractText())

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jan 2, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...