diff-pdf
visual PDF comparison tool
TLDR
SYNOPSIS
diff-pdf [options] file1.pdf file2.pdf
DESCRIPTION
diff-pdf compares two PDF files visually, rendering each page and performing pixel-by-pixel comparison. Unlike text-based diff tools, it captures visual differences including formatting, fonts, images, and layout changes that wouldn't be visible in a text comparison.The tool rasterizes each page from both PDFs and compares the resulting images. It can generate a difference PDF highlighting changes in color, or open an interactive viewer for side-by-side comparison. The --channel-tolerance and --per-page-pixel-tolerance options allow small rendering variations to be ignored.This is particularly useful for comparing versions of documents where content may be identical but visual presentation differs, or for quality assurance workflows verifying that document generation produces consistent output. The tool returns exit code 0 if files are identical, 1 if different, making it suitable for automated testing.
PARAMETERS
--output-diff file
Output the visual difference to a PDF file.--view
Open the comparison in an interactive viewer window.-m, --mark-differences
Additionally mark differences on left-side pages with a rectangle.-g, --grayscale
Render pages in grayscale so only differences appear in color.--channel-tolerance N
Allow up to N (0-255) difference per color channel before flagging a pixel.--per-page-pixel-tolerance N
Allow up to N differing pixels per page before reporting the page as different.--dpi N
Rasterization resolution in DPI (default: 300).-s, --skip-identical
In the output PDF, skip pages that are identical.-v, --verbose
Verbose output.