Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 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 (12.7k points)
0 votes
1 answer
0 votes
1 answer
asked Jan 2, 2021 in Python by ashely (50.2k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers

501 comments

104k users

Browse Categories

...