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
1 2 3 4 5 6 7 8 9 |
# 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
python app.py
Now if you check a output.jpg
will be created inside the root directory