How To Read Pdf File In Python Without Converting It In Unix?
pdfile=open('tutorial.pdf','r') xyz= pdfile.readlines() pqr=pdfile.readline() for a in xyz: print a this code doesnot display actual content. Instead it displays some question
Solution 1:
PDF files contain formatted data, you cannot read directly,
so use pyPdf module! click here http://pybrary.net/pyPdf/ Install and you can read without converting.
Solution 2:
A PDF file is not plain text - you can't just print its bytes to the terminal. You'd need to use a PDF-reading library (see Python PDF library for some suggestions) to read it.
Solution 3:
If you are working with textual PDF files, I would suggest using PDFMiner. (A complete example can be found here: https://github.com/syllabs/pdf2text)
Post a Comment for "How To Read Pdf File In Python Without Converting It In Unix?"