Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/apache/pdfbox/llms.txt

Use this file to discover all available pages before exploring further.

The render command uses PDFBox’s PDFRenderer to rasterize each page of a PDF into an image file. Output filenames follow the pattern <prefix>-<pageNumber>.<format>. You can target a single page, a range of pages, or all pages in one pass, and control resolution, color depth, and output quality independently.

Usage

java -jar pdfbox-app-3.0.0.jar render -i <input.pdf> [options]

Options

OptionDefaultDescription
-i, --input(required)Path to the input PDF file
-password(none)Password to decrypt the document
-formatjpgOutput image format (e.g. jpg, png, gif, bmp)
-prefix, -outputPrefix(auto)Filename prefix for output images; defaults to the input path without extension
-page(all pages)Render only this single page (1-based); overrides -startPage/-endPage
-startPage1First page to render (1-based)
-endPage(last page)Last page to render (inclusive)
-dpi, -resolutionscreen DPI or 96Output image resolution in dots per inch
-colorRGBColor depth: RGB, RGBA, GRAY, BINARY, ARGB, BGR, GRAY
-quality0 (PNG) / 1 (other)Compression quality between 0.0 and 1.0
-cropbox(none)Override crop box for all pages: four integers llx lly urx ury in user-space units
-subsamplingfalseEnable subsampling for PDFs containing very large images (reduces memory use)
-timefalsePrint render time statistics to stderr

Examples

Render all pages of a PDF to JPEG at screen resolution:
java -jar pdfbox-app-3.0.0.jar render -i document.pdf
# writes: document-1.jpg, document-2.jpg, ...
Render page 5 only to PNG at 150 DPI:
java -jar pdfbox-app-3.0.0.jar render -i document.pdf -page 5 -format png -dpi 150
Render pages 1–3 to high-resolution grayscale TIFF:
java -jar pdfbox-app-3.0.0.jar render -i document.pdf \
  -startPage 1 -endPage 3 -format tiff -dpi 300 -color GRAY
Render a specific page area using a custom crop box:
java -jar pdfbox-app-3.0.0.jar render -i document.pdf \
  -page 1 -cropbox 0 400 595 842 -format png
Use -subsampling when processing scanned PDFs that embed very large raster images to avoid out-of-memory errors. For archival output, prefer -format tiff -dpi 300 with lossless compression.

Build docs developers (and LLMs) love