How to compare the differences between two PDF files on Windows?

209

99

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.

Nelson Reis

Posted 2009-09-24T09:45:45.883

Reputation: 413

1

There is a FREE library to compare pdf pixel by pixel. Check this blog: http://www.testautomationguru.com/introducing-pdfutil-to-compare-pdf-files-extract-resources/

– Vinoth S – 2015-06-16T23:35:36.263

Answers

111

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.

Kenneth Cochran

Posted 2009-09-24T09:45:45.883

Reputation: 2 109

Many characters are missing from the text versions of the PDFs shown in the WinMerge diff windows – cja – 2018-06-25T09:40:16.863

There is also a plugin for TortoiseSVN that works well: http://freemind.s57.xrea.com/xdocdiff/e/index.html

– Mike Rowley – 2018-08-16T19:48:11.333

In the WinMerge compare dialog where you have the files, I had to select the plugin from the bottom right of the dialog. Select plugin -> <xdocdiff DLL file - amb... at time of writing> – the_new_mr – 2019-03-30T13:51:06.443

Tried this but couldn't see any difference when not using the xdocdiff plugin. Is there an option to select in WinMerge's UI? – Umber Ferrule – 2012-09-18T09:53:24.420

2

What is the purpose of viewing the binary text in a PDF? I expected to see the visual differences as done by i-net PDFC.

– JJD – 2013-01-04T11:03:30.190

Was there any way to make this handle column breaks? Without it one change cascades into several. – Stuart – 2013-04-29T23:48:48.670

2Plugins > List and tick the "Enable Plugins" checkbox was what was missing for me! – Seph – 2014-05-05T11:28:54.743

173

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).

emacsomancer

Posted 2009-09-24T09:45:45.883

Reputation: 441

3I tried using this for a novel that I export to PDF. Unfortunately the tool lost track after around 10 pages and considered everything to be "different", even though large passages were exactly the same. – Eric J. – 2016-03-02T19:50:10.350

OSX version could be build from source. It's easy to buid with command ./build_osx.sh from this source: https://github.com/Speakus/diffpdf

– Maxim Kholyavkin – 2016-04-19T00:28:02.343

13

Proper name is DiffPDF (as seen in the screenshot) and it's based on Qt 4 and Poppler library, thus it is portable. See DiffPDF homepage: http://www.qtrac.eu/diffpdf.html. Information about Windows build is here: http://soft.rubypdf.com/software/diffpdf. And your installation instruction works on Debian too.

– przemoc – 2011-05-22T17:59:26.960

diffpdf seems to be missing some differences on my Ubuntu Lucid machine. – Matt Alexander – 2012-03-02T00:15:09.627

4

The DiffPDF home page now has links for Linux, Windows installer, and Mac DMG installs as well (http://www.qtrac.eu/diffpdf.html).

– studgeek – 2012-10-25T19:37:26.087

1As of this writing DiffPdf on Windows has a minor problem when the 2 PDFs differ in length - both appear to end when the shorter one does. For example if I have a one-page PDF doc, and someone added in places all over it to bring it to 2 pages, the diff compares the first page of each, and does not show the second page with the parts that have been added. – Chris Moschini – 2013-03-09T21:14:49.727

2Tried DiffPDF, but doesn't appear to match blocks which move (like a conventional diff tool) - not that useful. – Umber Ferrule – 2013-12-04T12:05:13.370

6DiffPDF is the most advanced tool presented here, in my opinion. Not only does it offer a nice graphical comparison, but it tracks changes more cleverly than others, e.g. the xdocdiff for WinMerge. However, it has one serious problem: It limits the comparison to pages. That means, if you have some text on page 2 of document A, but this text moves to page 3 in document B, then the tool thinks its gone in A and added in B. – caw – 2014-03-29T01:31:50.440

1For @MarcoW.'s problem you will need to adjust the page comparison instruction at the top. It should be 1-1,2-3 for A and 1-1,3-3 for B. Also, version 3.x is non-free, non-portable, and slower than version 2.x in @przemoc's link, so I'm not sure there's a reason to use it. – Quail – 2014-04-01T09:53:15.543

7

The older free versions can be found here

– Shafik Yaghmour – 2014-06-04T12:29:12.137

44

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

Posted 2009-09-24T09:45:45.883

Reputation: 101

This is great! Is there anyway to track progress on large files when outputting to a PDF file (not using the --view option)? The verbose option /v does not seem to do anything. Also when you run the command to generate a compare PDF it runs in a separate process so it does not pause the command prompt like normally happens when you execute something from the prompt. – LukeS – 2016-11-28T19:10:51.490

This is the one I needed. I'm comparing PDF reports about numeric executions, so I'm looking for differences in one digit in a whole page. Problem is, I can not identify the cyan characters, but knowing where the difference is, is enough to find it in the original reports. – manuelvigarcia – 2017-05-04T09:44:04.757

10

Just one more note about diff-pdf: DiffPDF is great for quick visual side-by-side comparison of changed text, but it is practically impossible to debug stuff like, say, small changes in line spacing - diff-pdf on the other hand, basically puts the page contents from both compared files on the same page (but with different color) - so line spacing problems can be easily identified... Cheers!

– sdaau – 2011-10-06T10:20:13.660

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.

Epaga

Posted 2009-09-24T09:45:45.883

Reputation: 439

I couldn't get this to work. Loaded the two files and clicked on the compare button and nothing happens. – Craig Fisher – 2016-06-10T17:57:57.403

1Correctly handles cross page differences. Has an export/print functionality. Different comparison profiles (including custom). Mouse over gives you more details on what changed. Looks great. Drawbacks are the trial/cost and doesn't handle moves. Definitely superior to the tools higher voted IMO. – Jonathan Gawrych – 2017-11-21T20:19:29.237

@JonathanGawrych thanks for the kind words! What do you mean by "moves", exactly? Maybe we could add that functionality... – Epaga – 2017-12-05T09:24:42.163

@Epaga If a section of text is moved from one page to another, it is displayed as a delete and an addition. For example compare c++ proposals N4663 and N4680. See around page 19, an example is moved from paragraph 11 to 8, however it's treated as an addition/deletion. To see the actual differences, one would need to manually detect something moved, then copy the example to another diff tool to see that things were added to the example (unhandled_exception, return_void, etc.)

– Jonathan Gawrych – 2017-12-05T17:21:45.773

1yowsers this is $200 a year software! – voxobscuro – 2018-09-11T22:50:44.180

1Nice bit of software. – Umber Ferrule – 2012-09-18T09:53:49.207

11

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

Babak Farrokhi

Posted 2009-09-24T09:45:45.883

Reputation: 11

1Acrobat or Acrobat Reader? the Reader software doesn't have this – Jason S – 2012-11-28T17:06:52.477

5AcrobatX Pro is the only version which has this feature. The "just plain AcrobatX" does not. – Carl Witthoft – 2013-02-20T21:16:40.627

2In Acrobat 9 Pro it's under the Document menu. – svinto – 2013-06-28T13:15:28.860

10

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

Posted 2009-09-24T09:45:45.883

Reputation: 213

@philcolbourn Google+ is being shut down, maybe share the screenshot via imgur? – myrdd – 2019-03-25T21:56:03.003

fwiw, I've stumbled upon this tiny repo: https://github.com/tpltnt/cli-diffpdf/blob/master/cli-diffpdf.sh

– myrdd – 2019-03-26T08:17:45.760

If you're using Windows, Mac, Fedora, openSUSE or you're capable of compiling the binaries from source for your system, diff-pdf is a better solution that accomplishes this without needing to install three different dependencies. Not to be confused with diffpdf mentioned in another answer, which functions via GUI only.

– Hashim – 2019-06-20T21:58:04.497

Note that the pc-script.bash script does not escape characters for HTML. – Federico – 2019-08-14T15:18:30.257

7

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

Not free, but there is a thirty day trial.

sgmoore

Posted 2009-09-24T09:45:45.883

Reputation: 5 961

Yep, New > Text Compare helped me see basic differences in the text between 2 PDF files. – Ryan – 2018-05-22T17:23:44.050

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.

WimV

Posted 2009-09-24T09:45:45.883

Reputation:

Easiest and most simple tool I found to use. I wish I could upvote this more than once! – Chad – 2015-07-13T02:48:37.310

For PDF the comparison seem to be textual. Last release in 2010. You can pay for it but sure what difference is - I did't see any limitations ? – Zitrax – 2015-11-20T13:47:51.507

1This was the best and easiest of all for me. Thanks! – Ankur Jain – 2012-04-18T07:41:33.983

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

Posted 2009-09-24T09:45:45.883

Reputation: 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

Hermann Ingjaldsson

Posted 2009-09-24T09:45:45.883

Reputation: 444

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

Posted 2009-09-24T09:45:45.883

Reputation: 111 572

Hum... not quite what I was looking for, but thanks. – Nelson Reis – 2009-09-24T09:50:53.173

Sorry, I know not a good answer but just saying that I have never found a good tool for PDF files. – William Hilsum – 2009-09-24T09:55:09.140

3cross your eyes so that the two copies overlap, and any differences will appear to flicker. :D – endolith – 2014-03-04T16:12:02.400

Optimized version of this method: open both PDF files in acrobat reader full screen via CTRL+L, then use CTRL+F6 to switch between the PDF files, anything that moves is different... – Bernard Vander Beken – 2014-06-18T13:12:36.620

0

pdf-diff is a Python package for this purpose.

Ioannis Filippidis

Posted 2009-09-24T09:45:45.883

Reputation: 230

Is this text-only or graphical? – endolith – 2018-10-22T16:45:35.650

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

Posted 2009-09-24T09:45:45.883

Reputation: 974

0

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

Posted 2009-09-24T09:45:45.883

Reputation: 31

0

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

Posted 2009-09-24T09:45:45.883

Reputation: 738

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.

Dave Webb

Posted 2009-09-24T09:45:45.883

Reputation: 10 126

In this case it would be hard, since there are lots of PDF documents and the modifications happen very frequently.
But thanks for the suggestion.
– Nelson Reis – 2009-09-24T10:20:14.707

Also not great for LaTeX output - I haven't found one of these converters that handles ligatures etc properly. – Chris H – 2013-09-03T10:19:19.480

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

Posted 2009-09-24T09:45:45.883

Reputation: 306 093

And it's buggy anyway: https://forums.adobe.com/thread/647854?tstart=0

– Michal Sokolowski – 2015-07-20T12:42:11.923

"for a whopping $449" ... and how many MB of disk space? – Hugh Allen – 2009-11-07T06:17:43.017

4@Hugh Allen: A hell of a lot of disk space and a few tens of thousands of entries in the registry. A real bloatware. – harrymc – 2009-11-07T10:53:11.727

Updated help article for Adobe Acrobat XI: http://www.adobe.com/uk/products/acrobat/file-compare-two-pdf-files.html

– Squig – 2013-09-23T14:44:14.697

0

Diff Doc - not free.

Rook

Posted 2009-09-24T09:45:45.883

Reputation: 21 622

0

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

Posted 2009-09-24T09:45:45.883

Reputation: 153