LinuxCommandLibrary

diff-pdf

visual PDF comparison tool

TLDR

Compare two PDFs visually

$ diff-pdf [file1.pdf] [file2.pdf]
copy
Output difference to new PDF
$ diff-pdf --output-diff=[diff.pdf] [file1.pdf] [file2.pdf]
copy
Show visual comparison
$ diff-pdf --view [file1.pdf] [file2.pdf]
copy
Set per-pixel fuzz (tolerance)
$ diff-pdf --per-pixel-fuzz=[0.01] [file1.pdf] [file2.pdf]
copy

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 red, or open an interactive viewer for side-by-side comparison. A fuzzy tolerance parameter allows 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 visual difference to PDF file.
--view
Open visual comparison in viewer.
--per-pixel-fuzz value
Tolerance for pixel differences (0-1).
--mark-differences
Highlight differences in output.
-v, --verbose
Verbose output.

SEE ALSO

pdftk(1), diff(1), cpdf(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community