Compare PDF documents with DiffPDF

Subtle Differences

© Photo by Sumner Mahaffey on Unsplash

© Photo by Sumner Mahaffey on Unsplash

Article from Issue 294/2025
Author(s):

Most PDF viewers lack a function for comparing PDF files, but DiffPDF shows you the differences at a glance.

Differ tools, which compare two files and visually highlight the differences between them, exist for many file and archive formats. These programs are particularly useful if you have two or more versions of a file and cannot see the differences immediately. Many of these comparison tools are command-line-based and require knowledge of an extensive set of parameters. If you need to compare PDF files, DiffPDF [1], with its graphical user interface, compares both the text components of two PDF files as well as the embedded images for differences.

According to the original developer, the free version of DiffPDF is no longer under active maintenance due to the European Union's 2024 Cyber Resilience Act [2]. As a result, the binary package is no longer available on the DiffPDF website. Instead, you need to download it from your distribution's repository. You will find DiffPDF in the repositories of most of the popular distributions [3] and can conveniently install it with your distribution's package manager. Doing so creates a starter in the main menu. You can also run the software at a prompt. For an overview of parameters, use the diffpdf --help command. The graphical version also comes with a help function that explains the tool's individual functions.

On first launch, a three-pane program window pops up. When loaded, the files to be compared appear in the two larger panes on the left and in the middle. Above this, there is a single line with the fields for the file names and paths. You can see the actual controls in the third window segment on the far right. The Controls tab and the matching dialog are shown at the top. The Actions dialog is located in another tab line at the bottom. However, you will not find a menubar or a buttonbar.

Using the Program

Start by loading the two files you want to compare. To do so, select File #1 top left. DiffPDF then opens a file manager to let you browse to the directory of the first file and load it. This file is not shown in the window segment for the time being; instead you will see a prompt relating to selecting the second file. Now click on File #2 and select and load the comparison document. You will still only see a note, telling you to start the comparison by pressing the button. If you accidentally select the same file twice, DiffPDF displays a warning telling you that it Cannot compare a file to itself.

Alternatively, you can drag and drop the files to be compared from the file browser into the window segments. The user instructions are identical to those displayed for manual file selection in the dialog. Now press Compare in the Actions section bottom right to load the two documents into a slightly smaller view in the corresponding window segments. The differences are highlighted in red (Figure 1).

Figure 1: The differences immediately catch the eye thanks to color highlighting.

On the left-hand side of the view, you will find red vertical bars at the points where DiffPDF has identified differences. You can adjust the width of these markers to suit your needs after clicking on Options on the right below the Compare button and entering a larger numerical value in the Rule width input field in the dialog.

In the Highlighting tab in the same window, you can make further changes to the appearance if necessary. For example, you can change the highlighting color by choosing an entry from the selection list and alter the opacity of the color-highlighted background to improve readability.

To view the individual pages of multipage documents opposite each other in the window segments, select the respective pair of pages in the View selection field in the Controls tab top right. You can then use the Previous and Next buttons to scroll through the documents page by page. If the pages are so small that you cannot clearly see the differences on screen, you can zoom in by selecting a larger value in the Zoom field. As soon as you click Compare again after making the change, both documents will be zoomed with the new setting.

Comparison Modes

DiffPDF offers three different comparison modes, which you can set in the Compare selection box in the Controls tab top right. By default, DiffPDF uses a word-for-word comparison, but it alternatively supports character-for-character and visual modes. Visual mode is used to compare images in the PDFs. You can use this function, say, to make sure that individual charts or images are up to date when evaluating statistical data. The character-for-character comparison, on the other hand, enables comparison of PDF documents based on logographic writing systems, including Chinese Hànzì and Japanese Kanji.

The Zoning tab bottom right in the program window is where you define range numbers, which the app then includes in the comparison, as well as the horizontal and vertical tolerances (Figure 2). You can define columns here, for example. A little effort put into customization can help to reduce the false positive rate, especially for tables. In the case of single-column continuous text, DiffPDF provides the individual areas with a small frame and an ascending number, which helps you to find certain paragraphs more quickly and improves the overview. For multipage documents, the numbering restarts on each page.

Figure 2: You can use area numbering to improve the overview.

DiffPDF compares the documents page by page. This is why it tags document parts as different if they exist in both files but on different pages. The number of differences found is shown in red in the log data, which you will find bottom right below Log. The log also tells you the number of pages where DiffPDF found differences.

Documentation

You can save the individual comparisons for documentation purposes by using the Save as option in the Actions tab bottom right. In the configuration dialog, you need to specify whether you want the routine to save all pages or just the current page and whether the program should save just one of the two compared pages or both pages side by side. After specifying a file name and a path, the application saves the content as a PDF file that you can then open with any standard PDF viewer (Figure 3). DiffPDF does not save the control and configuration dialogs displayed in the program window on the right. Instead, it limits the content to the results of the current comparison, including all visual highlighting.

Figure 3: The comparison results can be saved for documentation purposes.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Command Line – diff and merge

    Diff and merge: They're not just for developers.

  • BeeDiff

    BeeDiff compares two files and quickly displays the differences in a convenient desktop GUI interface.

  • Command Line: Diffutils

    The Diffutils tool set helps you compare text files, discover and display the differences between files, and even automatically synchronize files.

  • File Comparison

    With support for more than 60 file formats, diffoscope extends the power of diff beyond the plain text or HTML file.

  • Diff Algorithms

    Diff finds the differences between two versions of a file. We’ll show you how diff finds changes and matches in files without affecting a system's resources.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News