Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DilwoarH/pdf-visual-regression/llms.txt
Use this file to discover all available pages before exploring further.
Synopsis
Positional arguments
Path to the first PDF file to compare.This serves as the baseline or reference document. Can be an absolute or relative path.Example:
Path to the second PDF file to compare.This is compared against
pdf1 to detect visual differences.Example:Optional arguments
Directory to save difference images and results.A timestamped subdirectory will be created within this path for each comparison run. The timestamp format is Examples:
YYYYDDMM_HHMMSS.Function signature: compare_pdfs:15The output directory is created automatically if it doesn’t exist. See
pdf_visual_diff.py:16-17.Similarity threshold for SSIM (Structural Similarity Index) comparison.Valid range: Comparison logic: Examples:
0.0 to 1.01.0= Requires pixel-perfect match (strictest)0.999= Internal default used in comparison logic (pdf_visual_diff.py:10)0.95= Tolerates minor rendering differences- Lower values = More tolerant of differences
compare_pdfs:10pdf_visual_diff.py:56Help and version
-h, --help
Show help message and exit.Output:
Exit codes
The tool uses standard Python exit codes:| Code | Meaning |
|---|---|
0 | Successful execution (both identical and different PDFs) |
1 | Runtime error (file not found, invalid PDF, etc.) |
2 | Command-line argument error |
The tool does NOT use different exit codes for identical vs. different PDFs. Check the
results.json file or parse stdout to determine comparison results programmatically.Complete examples
Implementation details
Argument parsing
The CLI uses Python’sargparse module. See pdf_visual_diff.py:137-145:
Function signature
The underlying comparison function (pdf_visual_diff.py:10):
See also
- Configuration options - Detailed guide for threshold and output settings
- Output formats - Understanding generated files
- Basic comparison - Getting started guide