Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

text-mine PDF files with Python?

Is there a package/library for python that would allow me to open a PDF, and search the text for certain words?

like image 501
Tony Stark Avatar asked Nov 04 '09 07:11

Tony Stark


2 Answers

Using PyPdf2 you can use extractText() method to extract pdf text and work on it.

Update: Changed text to refer to PyPdf2, thanks to @Aditya Kumar for heads up.

like image 123
ismail Avatar answered Sep 24 '22 13:09

ismail


I don't think you can do it in one step, but you can certainly get the text out of a pdf with pdfminer. Then you can apply whatever text search to that recovered data.

like image 43
shylent Avatar answered Sep 24 '22 13:09

shylent