Free Command Line tool to Compare PDF Files to Highlight Differences

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




PDF-Diff is a Command Line Tool that helps you to Compare two PDF files and Visualize the differences between them. It is available for Windows and Linux (Ubuntu distro).

PDF-Diff used PDFtoppm, a library that enables the conversion of the PDF files to a series of PNG images (one image per page). It then stores these images in 2 folders (one for each PDF) that are named as the ‘hash value’ of the content of the PDF file. Finally, PDF-Diff uses a pixel comparison algorithm to compare the respective images in the two folders, creates PNG images for every page where differences are found and highlights them with a specified color. These images representing the differences are stored in the ‘Generated’ folder.

How to Use:

1. Navigate to the GitHub page of PDF-Diff using the link provided at the end of this article, unzip the .gz file and store it in a specified folder.

2. Additionally, download PDFtoppm from the link provided, unzip the .7z file and save the contents to a specified folder. The ‘bin’ folder contains the main file pdftoppm.exe. You must edit the Path variable to include the path to this folder such as ‘D:\poppler-0.68.0\bin

3. Open the Windows Command Prompt, navigate to the folder where you have unzipped and saved the PDF-diff files and run the following command to compare the differences

pdf-diff pdf-file-1 pdf-file-2

If the PDF files aren’t in the same folder as PDF-Diff, make sure to type their complete path in the command line.

PDFdiff Command 1

4. After this command is processed, you will find 3 additional folders. Two of them will be named after the hash value of the PDF files and a third one will be the ‘Generated’ folder. Once you open it you will find PNG images highlighting the differences between the two PDF files. Open each PNG image to easily visualize the differences.

Folders

 

Highlights

5. To specify a color for highlighting the differences, use the command line option ‘-color hex-color’. For example to highlight the differences using blue color, use the following command

pdf-diff pdf-file-1 pdf-file-2 -color 0000FF

If this command line option is not used, Red color (ff2010) is used as default.

Pdfdiff command

You must remember that if a folder with the ‘hash value’ name already exists, then PDF-diff will not create any images as it considers that the algorithm has been run and the PNG images are already generated. This may typically happen when you have already compared the differences between two PDF files and want to repeat the process due to newer versions. In such a case, you must delete the two folders named after the hash values as well as the contents of the Generated folder.

Also, if the Path variable is not updated or the PDFtoppm library is not found in the specified Path, then PDF-diff will simply create empty folders without any PNG files.

Final comments:

Overall PDF-Diff looks to be a good tool, but the developers should have included a GUI version too along with the command line utility as many users may not prefer it. The PNG files with the highlighted differences are good in quality and self-explanatory.

Click here to download the PDF-Diff compressed file. Make sure that you download the correct package from the list of files based on your operating system and architecture.

Click here to download the latest binary for PDFtoppm.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]
Free/Paid: Free

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer