Python

Pyhton Code to Get Text Data From Pdf File by fetching form URL or Form Local Drive

In Pyhton Code to Get Text Data From Pdf You need to in install the folowing python librery for data read form the pdf document.

1.urllib

This librery will help you to download data file or pdf from the internet.

To install urllib command

pip install urllib

pip install urllib2

pip install urllib3

import urllib

urllib.urlretrieve('http://ird.iitd.ac.in/sites/default/files/jobs/project/advtprofaksrivastava2.pdf', 'data.pdf')

2.PyPDF2

This library will help you to read the pdf and extract data

import PyPDF2
pdfFileObj = open('data.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
print pdfReader.numPages
pageObj = pdfReader.getPage(0)
print pageObj.extractText()

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *