“pdftoppm” is a command-line utility that allows you to convert pages from a Portable Document Format (PDF) file into portable pixmap (PPM) image format. PPM is a simple image format that stores image data in ASCII or binary format.
“pdftoppm” is part of the Poppler library, which is a PDF rendering library used by many applications to display and print PDF files. By using “pdftoppm”, you can convert a PDF document into a series of images, each representing a single page from the original document.
The conversion process is performed by specifying the input PDF file and the desired output image format (such as PPM), along with a range of optional arguments that control the output format and resolution. For example, you can specify the desired width and height of the output images, the desired resolution, and whether to output the images in color or grayscale.
“pdftoppm” is useful in a variety of situations, such as when you need to convert a PDF document into a series of images for use in a presentation or when you need to extract individual pages from a PDF document for further processing. By providing a flexible and easy-to-use interface for converting PDF documents into image format, “pdftoppm” is a valuable tool for anyone working with PDF files.
If you encounter the below error while running the command pdftoppm:
pdftoppm: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install poppler-utils |
Ubuntu | apt-get install poppler-utils |
Alpine | apk add poppler |
Arch Linux | pacman -S poppler |
Kali Linux | apt-get install poppler-utils |
CentOS | yum install poppler-utils |
Fedora | dnf install poppler-utils |
OS X | brew install poppler |
Raspbian | apt-get install poppler-utils |
pdftoppm Command Examples
1. Specify the range of pages to convert (N-first page, M-last page):
# pdftoppm -f N -l M path/to/file.pdf image_name_prefix
2. Convert only the first page of a PDF:
# pdftoppm -singlefile path/to/file.pdf image_name_prefix
3. Generate a monochrome PBM file (instead of a color PPM file):
# pdftoppm -mono path/to/file.pdf image_name_prefix
4. Generate a grayscale PGM file (instead of a color PPM file):
# pdftoppm -gray path/to/file.pdf image_name_prefix
5. Generate a PNG file instead a PPM file:
# pdftoppm -png path/to/file.pdf image_name_prefix