Comparing PDF files

Learn how to check the differences between two PDF files.

Procedure

Add the Compare PDFs (comparePDFs) command to your script to compare the differences between a source and destination PDF file with text-based content. Use the source PDF file as the base for the comparison, and the destination PDF file to compare to the source.

This command returns these files highlighted where it identifies changes. The checker highlights as in the following situations:

Replaced content:

That command highlights the content in the source PDF file in yellow and the content in the destination PDF file in cyan (blue) where it identifies a replaced content.

The content in the source PDF file is highlighted in yellow.
Figure 1. The image shows the content of the source PDF file highlighted in yellow after the comparison with the content in the destination PDF file.

The content in the destination PDF file is highlighted in cyan.
Figure 2. The image shows the content of the destination PDF file highlighted in cyan after the comparison with the content in the source PDF file.

Removed content:

That command highlights the content in the source PDF file in red where it identifies that the file is removing content in comparison with the content on the destination PDF file.

The content in the source PDF file is highlighted in red.
Figure 3. The image shows the content of the source PDF file highlighted in red after the comparison with the content in the destination PDF file.

Added content:

That command highlights the content in the destination PDF file in green where it identifies that the file is adding content in comparison with the content on the source PDF file.

The content in the destination PDF file is highlighted in green.
Figure 4. The image shows the content of the destination PDF file highlighted in green after the comparison with the content in the source PDF file.