32

I am looking for an application to compare two PDF files.

Application must:

  • be able to highlight differences between the two documents
  • be mac-compatible as I will be using it on a mac
  • be free, I do not want to spend any money

I will be mostly using this for comparing the new versions of license agreements (since I am too lazy to read a 40+ page document every time a minor change is made)

The application does not need to be from the App Store, nor does it need to need to be official all I need is for it to do what it is intended to do (compare PDF's) very well.

I won't use this application very often and will accept it in any of the following formats:

  • Mac app store app
  • Java app
  • Web app
  • AppleScript file (I will need to see the source code)
  • Automator workflow
  • basically anything that will run on Mac OS X Yosemite (non-beta) and perform the intended task effectively
4

6 Answers 6

6

You can use DiffNow:

  • it's free
  • web-app diff tool
  • works via pasting text; uploading files; using URLs

The only limitation is that files must be < 2048kb.

The sample on their site (first pdf vs. second pdf):

DiffNow UI

5
19

DiffPDF nowadays is an paid software for Windows only, but it was previously free and also available for OS X. You can still download such a previous version.

It allows both visual and textual comparison.

Screenshot taken from Lifehacker.com

5
  • 1
    Also hosted at DiffPDF for Mac - Free download and software reviews - CNET Download.com
    – Pat
    Commented Apr 19, 2016 at 19:11
  • 1
    Thanks for this! It works fine, but it seems to only compare page by page, so if you add a page early in a document, the comparison is useless.
    – Nagel
    Commented May 11, 2016 at 9:32
  • Hmm, seems that this version only partially works on MacOS Mojave, It highlights the differences, but otherwise only shows me a blank page. The search continues, I suppose
    – Patronics
    Commented Jan 25, 2021 at 20:57
  • For a “visual” comparison, parepdf.com works well. Commented Feb 8, 2022 at 3:56
  • Apart from some glitches in the GUI diffpdf 2.1.3 still seems to work on macOS Catalina (available here). By default the comparison images are blurry though. The trick for getting a crisp resolution for display on retina displays is to increase the zoom level to 400% and save the differences to a PDF file. Commented Nov 14, 2023 at 5:14
16

compare (command from ImageMagick)

If you want to compare the visual appearance of page 4 of a.pdf with page 6 of b.pdf, you can use ImageMagick's command line tool compare. Here is a variation of commands to try:

compare              a.pdf[3] b.pdf[5]              delta1.pdf
compare -density 300 a.pdf[3] b.pdf[5]              delta2.pdf
compare              a.pdf[3] b.pdf[5] -compose src delta3.pdf
compare              a.pdf[3] b.pdf[5] -fuzz 5%     delta4.pdf

(ImageMagick's frame/page counting is zero-based; so "[3]" means "page 4"...) This will create "delta" documents, where each pixel that is different between the pages is painted in red:

  1. The first variant keeps a pale version of a.pdf as a background image to the page.
  2. The second variant uses a resolution of 300 PPI (instead of the default 72 PPI).
  3. The third variant creates a white+red delta only (leaving away the pale background).
  4. The fourth variant does mark as red only those pixels which have a color difference of more than 5%.

It should be noted, that the comparison only works if the respective page sizes for the compared files are exactly identical.

diffpdf (GUI application)

DiffPDF is a GUI application which can process 2 or 3 PDF input and show the differences:

  1. There is a mode that compares text content only, highlighting word and character differences.
  2. There is another mode that compares visual differences and highlights them.

The home page only offers a paying Windows version now, but earlier versions were free. You can grab the source code e.g. from Debian, it includes compilation instructions for OS X.

14

When comparing PDF files, you have the choice between:

  • comparing the contents (i.e. the actual text)
  • comparing the pages as a whole (visual comparison).

While you might be looking for the first type of comparison, I wanted to offer a way to compare two PDF files page-by-page.

As I've had this requirement regularly in the past, and couldn't find the necessary software to perform the comparison, I wrote my own and made it available on GitHub. It's called pyPdfCompare and is available free of charge.

It runs fine on OS X and Windows but does require you to install Python 3, Ghostscript and ImageMagick. Furthermore, you'll need to perform a pip install for the libraries it uses.

It may be a little too technical and/or not exactly what you were looking for, but I wanted to offer the option anyway, for the sake of completeness.

5

For your use case, comparing the text and discarding all formatting and non-text elements would work well. You can run the pdftotext utility on each file and then a text comparison tool on the result. On OS X, you can install pdftotext from various free software distribution channels such as Brew or MacPorts, it's part of the poppler package.

Cas Cremers's pdfdiff.py script automates the running of pdftotext (which needs to be installed separately) and of a diff viewer (ditto).

The result is similar to DiffNow cited by ᔕᖺᘎᕊ, I think they use pdftotext internally and plug the output into a text diff webapp.

1

I figure I should add one more option that isn't necessarily a tool or feature, but more of a trick to compare small PDF's (generally single pages like resumes).

If your operating system makes windows semitransparent when dragging them around, you can open both PDF's in your PDF-viewing application, and then drag one PDF window over the other without letting go. This can allow you to see through the first, semitransparent window, through to the other PDF window beneath it. If they're lined up correctly with each other, the differences can become obvious.

I've often used this as a quick-and-dirty visual comparison to check if two single-page PDF's have the same content, but since it requires no software, it should work on any OS that has this semitransparent effect when moving windows around

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.