229

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,390
  • 3
  • 23
  • 41
Nelson Reis
  • 413
  • 3
  • 7
  • 9
  • 1
    Related: http://stackoverflow.com/questions/145657/tool-to-compare-large-numbers-of-pdf-files – Epaga Sep 10 '12 at 09:28
  • 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 Jun 16 '15 at 23:35
  • free. run in browser so works on all OSes. click the select text icon top right, the open primary doc in left pane and secondary doc in right page. then click the play button top left to start comparison. then scroll from page to page to see differences. https://demo.leadtools.com/JavaScript/DocumentComparison/index.html – JJ_Coder4Hire Nov 11 '20 at 21:37

19 Answers19

187

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
  • 1,798
  • 2
  • 18
  • 27
emacsomancer
  • 451
  • 3
  • 5
  • 11
  • 14
    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 May 22 '11 at 17:59
  • diffpdf seems to be missing some differences on my Ubuntu Lucid machine. – Matt Alexander Mar 02 '12 at 00:15
  • 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 Oct 25 '12 at 19:37
  • 1
    As 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 Mar 09 '13 at 21:14
  • 2
    Tried DiffPDF, but doesn't appear to match blocks which move (like a conventional diff tool) - not that useful. – Umber Ferrule Dec 04 '13 at 12:05
  • 10
    DiffPDF 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 Mar 29 '14 at 01:31
  • 1
    For @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 Apr 01 '14 at 09:53
  • 8
    The older free versions can be found [here](http://www.qtrac.eu/diffpdf-foss.html) – Shafik Yaghmour Jun 04 '14 at 12:29
  • 3
    I 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. Mar 02 '16 at 19:50
  • 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 Apr 19 '16 at 00:28
  • If you have a long document and a single page is added/removed, _every page_ after that is marked as _changed_, even though they are all identical! – automorphic Apr 09 '20 at 16:35
118

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,129
  • 2
  • 13
  • 32
Kenneth Cochran
  • 2,299
  • 3
  • 18
  • 17
  • 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 Sep 18 '12 at 09:53
  • 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](http://superuser.com/a/470207/85542). – JJD Jan 04 '13 at 11:03
  • Was there any way to make this handle column breaks? Without it one change cascades into several. – Stuart Apr 29 '13 at 23:48
  • 2
    `Plugins > List and tick the "Enable Plugins" checkbox` was what was missing for me! – Seph May 05 '14 at 11:28
  • Many characters are missing from the text versions of the PDFs shown in the WinMerge diff windows – cja Jun 25 '18 at 09:40
  • There is also a plugin for TortoiseSVN that works well: http://freemind.s57.xrea.com/xdocdiff/e/index.html – Mike Rowley Aug 16 '18 at 19:48
  • 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 -> – the_new_mr Mar 30 '19 at 13:51
  • Has anyone had their malware scanners alert that xdocdiffPlugin_1_0_6d.zip has malware (Trojan.Malware.300983.susgen)? – OutsideCoder Jul 20 '21 at 18:31
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}
Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
slestak
  • 101
  • 2
  • 3
  • 13
    Just one more note about `diff-pdf`: [DiffPDF](http://superuser.com/questions/46123/how-to-compare-the-differences-between-two-pdf-files/287107#287107) 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 Oct 06 '11 at 10:20
  • 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 Nov 28 '16 at 19:10
  • 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 May 04 '17 at 09:44
  • 1
    Note that diff-pdf is great for comparing spatially-sensitive images like technical drawings. It highlights the changed pixels of blueprints or schematics or graphs that have identical scaling, such as revisions of the same design. – deasserted Oct 27 '21 at 20:18
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,066
  • 1
  • 20
  • 29
Epaga
  • 439
  • 1
  • 6
  • 18
  • 1
    Nice bit of software. – Umber Ferrule Sep 18 '12 at 09:53
  • I couldn't get this to work. Loaded the two files and clicked on the compare button and nothing happens. – Craig Fisher Jun 10 '16 at 17:57
  • 1
    Correctly 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. – jgawrych Nov 21 '17 at 20:19
  • @JonathanGawrych thanks for the kind words! What do you mean by "moves", exactly? Maybe we could add that functionality... – Epaga Dec 05 '17 at 09:24
  • @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](https://isocpp.org/files/papers/N4663.pdf) and [N4680](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4680.pdf). 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.) – jgawrych Dec 05 '17 at 17:21
  • 2
    yowsers this is $200 a year software! – voxobscuro Sep 11 '18 at 22:50
14

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

philcolbourn
  • 193
  • 1
  • 1
  • 10
philfreo
  • 213
  • 2
  • 14
  • @philcolbourn Google+ is being shut down, maybe share the screenshot via imgur? – myrdd Mar 25 '19 at 21:56
  • 1
    fwiw, I've stumbled upon this tiny repo: https://github.com/tpltnt/cli-diffpdf/blob/master/cli-diffpdf.sh – myrdd Mar 26 '19 at 08:17
  • If you're using Windows, Mac, Fedora, openSUSE or you're capable of compiling the binaries from source for your system, [diff-pdf](https://vslavik.github.io/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 Aziz Jun 20 '19 at 21:58
  • Note that the `pc-script.bash` script does not escape characters for HTML. – Federico Aug 14 '19 at 15:18
  • It would be great if the script could strip the html of what is not text. In my case I get a lot of random circles where there are figures. – Manfredo Jun 08 '20 at 17:40
  • Thanks! `pdftotext -layout` was the magic here. I've made a kdiff3 fork of the script: https://github.com/timabell/cli-diffpdf/blob/master/cli-diffpdf.sh – Tim Abell Jun 09 '20 at 20:32
12

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

  • 1
    Acrobat or Acrobat Reader? the Reader software doesn't have this – Jason S Nov 28 '12 at 17:06
  • 7
    AcrobatX Pro is the only version which has this feature. The "just plain AcrobatX" does not. – Carl Witthoft Feb 20 '13 at 21:16
  • 2
    In Acrobat 9 Pro it's under the Document menu. – svinto Jun 28 '13 at 13:15
  • 2
    http://www.adobe.com/products/acrobat/file-compare-two-pdf-files.html – Iman Mar 02 '15 at 16:39
  • I tried Adobe Acrobat DC (not free) and it did a better job comparing a 50-page document of the rules of my son's daycare (the diffs were not not perfect, but it's a hard) than Winmerge (which got really confused by new footers) or diffpdf (which seems to do it page-by-page and that's a pretty big disadvantage). I dislike Adobe for lots of reasons, but in this case it was the best. – Fuhrmanator Aug 17 '20 at 17:12
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,423
  • 2
  • 25
  • 33
  • Yep, `New > Text Compare` helped me see basic differences in the text between 2 PDF files. – Ryan May 22 '18 at 17:23
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.

  • 1
    This was the best and easiest of all for me. Thanks! – Ankur Jain Apr 18 '12 at 07:41
  • Easiest and most simple tool I found to use. I wish I could upvote this more than once! – Chad Jul 13 '15 at 02:48
  • 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 Nov 20 '15 at 13:47
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
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

john-jones
  • 644
  • 3
  • 7
  • 16
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
  • 878
  • 1
  • 6
  • 15
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
  • 116,650
  • 19
  • 182
  • 266
0

pdf-diff is a Python package for this purpose.

0 _
  • 309
  • 4
  • 10
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,270
  • 14
  • 18
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
  • 11,876
  • 3
  • 43
  • 39
  • 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 Sep 24 '09 at 10:20
  • Also not great for LaTeX output - I haven't found one of these converters that handles ligatures etc properly. – Chris H Sep 03 '13 at 10:19
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
  • 455,459
  • 31
  • 526
  • 924
0

Diff Doc - not free.

Rook
  • 23,617
  • 32
  • 128
  • 213
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
  • 153
  • 5