pdftoppm
Convert PDF pages to PPM images
TLDR
Specify the range of pages to convert (n - first page, m - last page)
Convert only the first page of a PDF
Generate a monochrome PBM file (instead of a color PPM file)
Generate a grayscale PGM file (instead of a color PPM file)
Generate a PNG file instead a PPM file
SYNOPSIS
pdftoppm [options] PDF-file [output-file-prefix]
PARAMETERS
-f
Specifies the first page to convert.
-l
Specifies the last page to convert.
-r
Sets the resolution in DPI (dots per inch).
-scale-to
Scales output image to specified width, preserving aspect ratio.
-scale-to-x
Scales output image to specified width.
-scale-to-y
Scales output image to specified height.
-jpeg
Generates JPEG image files.
-png
Generates PNG image files.
-mono
Generates monochrome (1-bit) images.
-gray
Generates grayscale (8-bit) images.
-rgb
Generates color (24-bit) images (default).
-cropbox
Uses the PDF's crop box instead of media box.
-q
Suppresses all messages and errors.
DESCRIPTION
pdftoppm is a command-line utility used to convert pages from a Portable Document Format (PDF) file into various image formats, primarily PPM (Portable Pixmap) but also PNM, PNG, and JPEG. It's an essential tool for users needing to extract visual content from PDFs or render PDF pages as raster images for further processing or display.
The command offers a wide range of options to control the output, including resolution (DPI), page range, image format, color space, and compression. It's often used in scripting environments to automate the generation of thumbnails or full-page image representations of PDF documents. pdftoppm is part of the Poppler rendering library, which is a free software library for rendering PDF documents, inheriting much of its functionality from the Xpdf project.
CAVEATS
High resolution conversions can consume significant memory and CPU resources. Font rendering fidelity may vary depending on available system fonts. By default, output files are named using a pattern like `[prefix]-[page_number].ppm`.
OUTPUT FILE NAMING CONVENTION
When converting a single page, the output file will be named `[output-file-prefix].ppm` (or .png/.jpeg if specified). For multiple pages, pdftoppm appends a hyphen and the six-digit page number (e.g., `output-000001.ppm`). If no output file prefix is provided, the base name of the input PDF file is used as the prefix.
DEFAULT OUTPUT FORMAT
The default output format is PPM (Portable Pixmap). Users can explicitly choose PNG or JPEG formats using the `-png` or `-jpeg` options respectively.
HISTORY
Originating from the Xpdf project, pdftoppm is now maintained as part of the Poppler PDF rendering library. Poppler provides a free software solution for rendering PDF documents, and its development focuses on accurate and efficient PDF processing.