Back

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

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...