Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

extract pdf with python

first :pip install PyPDF2
# importing required modules
import PyPDF2
 
# creating a pdf file object
pdfFileObj = open('example.pdf', 'rb')
 
# creating a pdf reader object
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
 
# printing number of pages in pdf file
print(pdfReader.numPages)
 
# creating a page object
pageObj = pdfReader.getPage(0)
 
# extracting text from page
print(pageObj.extractText())
 
# closing the pdf file object
pdfFileObj.close()
Comment

python code for extracting data from pdf

# importing required modules 
import PyPDF2 
    
# creating a pdf file object 
pdfFileObj = open('example.pdf', 'rb') 
    
# creating a pdf reader object 
pdfReader = PyPDF2.PdfFileReader(pdfFileObj) 
    
# printing number of pages in pdf file 
print(pdfReader.numPages) 
    
# creating a page object 
pageObj = pdfReader.getPage(0) 
    
# extracting text from page 
print(pageObj.extractText()) 
    
# closing the pdf file object 
pdfFileObj.close()
Comment

PREVIOUS NEXT
Code Example
Python :: api testing with python 
Python :: python how to convert csv to array 
Python :: python log10 
Python :: find where df series is null and print 
Python :: python print on file 
Python :: change python3 as default for mac 
Python :: django radio button 
Python :: Read all the lines as a list in a file using the readlines() function 
Python :: print map object python 
Python :: django get group users 
Python :: df col to dict 
Python :: check if number is between two numbers python 
Python :: python get stock prices 
Python :: how to import file from another directory in python 
Python :: remove a column from dataframe 
Python :: get ContentType with django get_model 
Python :: clamp number in python 
Python :: make a window tkinter 
Python :: python webbrowser close tab 
Python :: python square all numbers in list 
Python :: f string in python 
Python :: json python 
Python :: full form of rom 
Python :: Clear All the Chat in Discord Channel With Bot Python COde 
Python :: get instance of object python 
Python :: Send GIF in Embed discord.py 
Python :: program count the number of occurrences of a letter in a string python 
Python :: plt.imread python 
Python :: exit python terminal 
Python :: knowing the sum null values in a specific row in pandas dataframe 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =