Python 3 Script to Convert PDF Document to Images Using pdf2image Library Full Example

Python 3 Script to Convert PDF Document to Images Using pdf2image Library Full Example

 

Welcome folks today in this post we will be converting pdf document to images using pdf2image library in python 3. All the source code of application is given below.

 

 

 

Requirements

 

 

In order to proceed you must have python installed on your system

 

 

Installation

 

 

After that we need to install pdf2image module using pip command as shown below

 

pip install pdf2image

 

 

After installing it make a app.py file and copy paste the following code

 

 

app.py

 

 

# import module 
from pdf2image import convert_from_path 
  
  
# Store Pdf with convert_from_path function 
images = convert_from_path('fancy.pdf') 
  
for img in images: 
    img.save('output.jpg', 'JPEG')

 

 

 

Now we need to execute this python script app.py by executing the following command which is shown below

READ  Python 3 Tkinter Status Bar Grid Widget Using ttk Library GUI Desktop App Full Project For Beginners

 

python app.py

 

Now if you check a output.jpg will be created inside the root directory

 

 

 

 

 

 

 

 

Leave a Reply