Before beginning this tutorial, you must have to install below package on your system. Use one of the following commands to install poppler package As you have installed required packages on your system. Let’s start converting pdf file to images via Linux command line.
Syntax
A basic syntax to convert a pdf file to image looks like: Here:
options – Define options like image format -png, -jpeg etc. PDF-file – Input PDF file image_name – Set a name for output images
1. Convert PDF to Image (all pages)
I have downloaded a sample pdf file with 5 pages. Then used pdftoppm command to convert PDF to images. It will create a separate image for each pdf page. You can also change -jpeg with -png to create png files. Once the file converted, use ls -l command to list all files in current directory. Here you will see all the images generated from pdf file.
2. Convert PDF to Image (Specific Pages)
Instead of creating images of all pages, you can also convert specific pages only. Here -f define the first page to start and -l defines the last page to convert. As per the above command, it will create images of pages 2 to 4 only.
3. Specify PDF Password
For the password protected pdf files, specify the user password using -upw command line option.
Conclusion
In this tutorial, you have learned to convert PDF to images using Linux command line. Use pdftoppm –help command to get more help about this command.