Action for visually comparing two PDF files using diff-pdf.
By default, This action is successful if there are no differences and failure if the two PDFs differ.
If given the --output-diff
option, it produces a PDF file with visually highlighted differences.
Input PDF file1 path. (required)
Input PDF file2 path. (required)
Specify diff-pdf command options if you need.
Follows are quoted from diff-pdf --help
:
-v, --verbose be verbose
-s, --skip-identical only output pages with differences
-m, --mark-differences additionally mark differences on left side
-g, --grayscale only differences will be in color, unchanged parts will show as gray
--output-diff=<str> output differences to given PDF file
--channel-tolerance=<num> consider channel values to be equal if within specified tolerance
--per-page-pixel-tolerance=<num> total number of pixels allowed to be different per page before specifying the page is different
--dpi=<num> rasterization resolution (default: 300 dpi)
Note: --view
option is not available.
If set true
, Exit code to 0 even there is a difference.
(Expected to be used with --output-diff
option)
None.
Note: Output following log when running this action. However, don't worry there is no problem.
Unable to init server: Could not connect: Connection refused
01:20:19: Error: Unable to initialize GTK+, is DISPLAY set properly?
jobs:
diff:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: nowsprinting/diff-pdf-action@v1
with:
file1: expected.pdf
file2: actual.pdf
options: --verbose
# If PDFs do not match, this step will fail.
jobs:
diff:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: nowsprinting/diff-pdf-action@v1
with:
file1: base.pdf
file2: head.pdf
options: --skip-identical --output-diff=diff.pdf --dpi=100
suppress-diff-error: true
jobs:
diff:
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: ghcr.io/nowsprinting/diff-pdf:latest
steps:
- uses: actions/checkout@v3
- run: diff-pdf --verbose expected.pdf actual.pdf
MIT License
Open an issue or create a pull request.
Be grateful if you could label the PR as enhancement
, bug
, chore
and documentation
. See PR Labeler settings for automatically labeling from the branch name.
Make change draft release to Publish release
.