← 返回命令列表

Linux command

diff-pdf 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Compare two PDFs

diff-pdf [file1.pdf] [file2.pdf]

Output difference

diff-pdf --output-diff=[diff.pdf] [file1.pdf] [file2.pdf]

Show visual comparison

diff-pdf --view [file1.pdf] [file2.pdf]

Set per-pixel fuzz

diff-pdf --per-pixel-fuzz=[0.01] [file1.pdf] [file2.pdf]

说明

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.

参数

--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.

FAQ

What is the diff-pdf command used for?

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.

How do I run a basic diff-pdf example?

Run `diff-pdf [file1.pdf] [file2.pdf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --output-diff _file_ do in diff-pdf?

Output visual difference to PDF file.