233

Do you know a good way to compare PDF files side-by-side and show the modifications between the two?

I'm looking for Windows software to accomplish this. It would be great if you can post both free and not-free products.

Robotnik
  • 2,645

19 Answers19

190

On Linux and Windows you can use diffpdf (which differs from diff-pdf mentioned in this thread).

enter image description here

On Ubuntu install using:

sudo apt-get install diffpdf

See further this UbuntuGeek page on comparing pds textually or visually.

For Windows, this Diffpdf Windows version works really great. You can download from http://soft.rubypdf.com/software/diffpdf (scroll down to Win32 static version).

Melebius
  • 2,059
120

Try WinMerge with the xdocdiff plugin. Both are completely free. No strings attached.


A couple of the comments below suggest they don't see any difference. That means the plug-in isn't installed correctly. Here's how:

  1. Put the files where the xdocdiff plugin's readme file says to put them (there are two places; I won't list them here as filenames can change, etc. — read the readme)

  2. In WinMerge, go to Plugins > List and tick the "Enable Plugins" checkbox (this step is missing from the xdocdiff readme)

  3. In WinMerge, choose Plugins > Automatic Unpacking (this was disabled prior to step 2)

Then when comparing, you'll see what look like text files in the comparison windows.

T.J. Crowder
  • 1,159
50

I recently found this and I love it.

https://github.com/vslavik/diff-pdf

Cross platform, free, and works well.

Here is a screenshot of diff-pdf in action - note that the text is not different in the PDF, but only fonts (and correspondingly, layout settings):

diff-pdf.png

The call to obtain that image was:

diff-pdf --view testA.pdf testB.pdf

 

... where testA.pdf/testB.pdf are obtained by compiling this simple Latex file with pdflatex (accordingly for each pdf, see comment):

\documentclass[12pt]{article}


                        % without mathpazo: testA.pdf
\usepackage{mathpazo} % with mathpazo: testB.pdf
\usepackage{lipsum}


\title{A brand new test}
\author{Testulio}

\begin{document}

\maketitle

\lipsum[1-3]

\end{document}
slestak
  • 101
22

We also needed to compare PDFs at our company and were not satisfied with any of the solutions we found, so we made our own: i-net PDFC. It's not free, but we do offer a 30-day trial.

It's written in Java, so it's cross-platform.

screenshot

What makes it special is that it compares the content as opposed to only the text (or just converting the pdf to an image and comparing the image). It also has a nice visual comparison tool.

Lightness Races in Orbit
  • 3,076
  • 1
  • 22
  • 29
15

I wanted to do this (diff PDFs) recently with these requirements:

  • ignore whitespace, line breaks, page breaks, etc.
  • easily see when just a couple words that changed, not just entire lines/paragraphs.
  • color diff output

I installed pdftotext, wdiff, and colordiff, available in various package managers. (With macports: sudo port install poppler wdiff colordiff)

Then:

wdiff <(pdftotext old.pdf -) <(pdftotext new.pdf -) | colordiff

Now I can see which words, nicely colored, have changed.

More details: http://philfreo.com/blog/how-to-view-a-color-diff-of-text-from-two-pdfs/

Variation:

Using dwdiff can produce slightly better results.

I also wanted HTML output so this tiny script makes a basic web page with a bit of CSS.

bash pc-script.bash old.pdf new.pdf > q.htlm

Then open q.html with your web browser.

pc-script.bash file:

#!/bin/bash

OLD="$1"
NEW="$2"

cat <<EOF
<html><head><meta charset="UTF-8"/><title>Changes from $OLD to $NEW</title></head><style>
.plus  { color: green; background: #E7E7E7;                                }
.minus { color: red;   background: #D7D7D7; text-decoration: line-through; }
</style><body><h1>Changes from [ <span class="minus">$OLD</span> ] to [ <span class="plus">$NEW</span> ]</h1><pre>
EOF

dwdiff -i -A best -P      \
  --start-delete='<span class="minus">' --stop-delete='</span>' \
  --start-insert='<span class="plus" >' --stop-insert='</span>' \
  <( pdftotext -enc UTF-8 -layout "$OLD" - )   \
  <( pdftotext -enc UTF-8 -layout "$NEW" - )   \

cat <<EOF
</pre></body></html>
EOF

An example of output can be seen here

enter image description here

philfreo
  • 223
12

You can also use Adobe Acrobat X. Its has built in PDF comparison functionality under "View -> Compare Documents.

8

If you are comparing text inside a pdf, then Beyond Compare does this.

Not free, but there is a thirty day trial.

sgmoore
  • 6,599
6

Great tool and easy to use : Compare-It v4 (from http://www.grigsoft.com/)

Compares many different kind of files. It has some built-in converters, including one for PDF files.

I've used it quite a few times with satisfying results.

Really should try this. Trial version allows comparison for unlimited time.

2

My proposal for best tool to compare PDFs is Kiwi PDF Comparer.

Unlike most, you can compare both text and images in the document and you also have another option to compare pages pixel-to-pixel. When comparing text it has more resolution tan everyone else because it highlights changed characters and not whole words.

It must also be the only software to do a PDF diff in which you do not have to go looking for the marked differences because you can go from one difference to another just one click.

There is a free version that works very well, but the paid version is also the cheapest one with a difference between professional applications. Being written in Java can be run on Windows, Linux and Mac OS.

Comparing documents with Kiwi

Larry
  • 59
  • 1
2

Don't know it, but there is also comparePDF (not free, but a 30 day trial possible): http://www.compare-pdf.com/download.htm

Robert
  • 11
1

Here you can upload two pdf's and get back the third one which will display to you the difference between the two.

Works on all platforms, theres nothing learn or install and its free.

https://synodins.com/apps/pdf_difference/intro.html

1

For a very primitive form of synchronized scrolling between two pdf files, you can use the following autohotkey script I wrote. It assumes you have two SumatraPDF windows open. Press right to go to the next page in both windows, press left for the previous page.

#IfWinActive ,SumatraPDF
Right::
orig := WinExist("A")
WinGet, outvar, List, SumatraPDF
win1 := outvar1
win2 := outvar2
WinActivate, ahk_id %win1%
sendinput {Right}
WinActivate, ahk_id %win2%
sendinput {Right}
WinActivate, ahk_id %orig%
return

Left::
orig := WinExist("A")
WinGet, outvar, List, SumatraPDF
win1 := outvar1
win2 := outvar2
WinActivate, ahk_id %win1%
sendinput {Left}
WinActivate, ahk_id %win2%
sendinput {Left}
WinActivate, ahk_id %orig%
return
ivanatpr
  • 918
1

Free, Not the best but...

I open both documents up and have them split screen against each other.

Not the most practical solution, but it works!

I have not seen a good DIFF package for PDF files and whilst manual and annoying, my way works!

William Hilsum
  • 117,648
1

I used this (non ideal, but for me sufficient) solution:

  • Convert PDF to plain text (in my case with Adobe Reader, free app)
  • Use opendiff (included with XCode, free) and see changes
Ciryon
  • 153
0

pdf-diff is a Python package for this purpose.

0 _
  • 323
0

There is also free online https://www.diffchecker.com/diff.

But it highlights only text differences without images and formatting. And it's too weak in matching unchanged fragments in large files.

Vadzim
  • 1,342
0

Another less than ideal solution:

  1. Convert both PDFs to Microsoft Word documents using one of the websites that do this for free.
  2. Use the document comparison functionality in Word.

Depending on how complex the formatting in the PDFs is and the kind of changes you're looking for, this might be OK.

David Webb
  • 12,294
0

Commercial: You can use the original Adobe Acrobat Professional, for a whopping $449 :
Compare a revised PDF to an earlier version.

If you decide on Acrobat, the comments on this page are pertinent to its use.

harrymc
  • 498,455
0

Diff Doc - not free.

Rook
  • 24,289