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

469,645

Solution 1

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.

Solution 2

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

Solution 3

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}

Solution 4

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.

Solution 5

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

Share:
469,645

Related videos on Youtube

Nelson Reis
Author by

Nelson Reis

Updated on September 17, 2022

Comments

  • Nelson Reis
    Nelson Reis 8 months

    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
    Nelson Reis over 13 years
    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.
  • Hugh Allen
    Hugh Allen over 13 years
    "for a whopping $449" ... and how many MB of disk space?
  • harrymc
    harrymc over 13 years
    @Hugh Allen: A hell of a lot of disk space and a few tens of thousands of entries in the registry. A real bloatware.
  • przemoc
    przemoc about 12 years
    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: qtrac.eu/diffpdf.html. Information about Windows build is here: soft.rubypdf.com/software/diffpdf. And your installation instruction works on Debian too.
  • tetram
    tetram over 11 years
    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!
  • Matt Alexander
    Matt Alexander about 11 years
    diffpdf seems to be missing some differences on my Ubuntu Lucid machine.
  • tiaga
    tiaga over 10 years
    Tried this but couldn't see any difference when not using the xdocdiff plugin. Is there an option to select in WinMerge's UI?
  • tiaga
    tiaga over 10 years
    Nice bit of software.
  • studgeek
    studgeek over 10 years
    The DiffPDF home page now has links for Linux, Windows installer, and Mac DMG installs as well (qtrac.eu/diffpdf.html).
  • Jason S
    Jason S over 10 years
    Acrobat or Acrobat Reader? the Reader software doesn't have this
  • JJD
    JJD over 10 years
    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.
  • Carl Witthoft
    Carl Witthoft over 10 years
    AcrobatX Pro is the only version which has this feature. The "just plain AcrobatX" does not.
  • Chris Moschini
    Chris Moschini about 10 years
    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.
  • Stuart
    Stuart about 10 years
    Was there any way to make this handle column breaks? Without it one change cascades into several.
  • svinto
    svinto almost 10 years
    In Acrobat 9 Pro it's under the Document menu.
  • Chris H
    Chris H over 9 years
    Also not great for LaTeX output - I haven't found one of these converters that handles ligatures etc properly.
  • tiaga
    tiaga over 9 years
    Tried DiffPDF, but doesn't appear to match blocks which move (like a conventional diff tool) - not that useful.
  • endolith
    endolith about 9 years
    cross your eyes so that the two copies overlap, and any differences will appear to flicker. :D
  • Alaa
    Alaa about 9 years
    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.
  • Quail
    Quail about 9 years
    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.
  • Seph
    Seph about 9 years
    Plugins > List and tick the "Enable Plugins" checkbox was what was missing for me!
  • Shafik Yaghmour
    Shafik Yaghmour almost 9 years
    The older free versions can be found here
  • user1846903
    user1846903 almost 9 years
    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...
  • Rui.Xie
    Rui.Xie about 8 years
  • Admin
    Admin almost 8 years
    Easiest and most simple tool I found to use. I wish I could upvote this more than once!
  • Michal Sokolowski
    Michal Sokolowski almost 8 years
  • Admin
    Admin over 7 years
    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 ?
  • Eric J.
    Eric J. about 7 years
    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.
  • Maxim Kholyavkin
    Maxim Kholyavkin about 7 years
    OSX version could be build from source. It's easy to buid with command ./build_osx.sh from this source: github.com/Speakus/diffpdf
  • Craig Fisher
    Craig Fisher almost 7 years
    I couldn't get this to work. Loaded the two files and clicked on the compare button and nothing happens.
  • LukeS
    LukeS over 6 years
    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.
  • manuelvigarcia
    manuelvigarcia about 6 years
    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.
  • Jonathan Gawrych
    Jonathan Gawrych over 5 years
    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.
  • Epaga
    Epaga over 5 years
    @JonathanGawrych thanks for the kind words! What do you mean by "moves", exactly? Maybe we could add that functionality...
  • Jonathan Gawrych
    Jonathan Gawrych over 5 years
    @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.)
  • Ryan
    Ryan about 5 years
    Yep, New > Text Compare helped me see basic differences in the text between 2 PDF files.
  • cja
    cja almost 5 years
    Many characters are missing from the text versions of the PDFs shown in the WinMerge diff windows
  • Mike Rowley
    Mike Rowley almost 5 years
    There is also a plugin for TortoiseSVN that works well: freemind.s57.xrea.com/xdocdiff/e/index.html
  • voxobscuro
    voxobscuro over 4 years
    yowsers this is $200 a year software!
  • endolith
    endolith over 4 years
    Is this text-only or graphical?
  • myrdd
    myrdd about 4 years
    @philcolbourn Google+ is being shut down, maybe share the screenshot via imgur?
  • myrdd
    myrdd about 4 years
    fwiw, I've stumbled upon this tiny repo: github.com/tpltnt/cli-diffpdf/blob/master/cli-diffpdf.sh
  • the_new_mr
    the_new_mr about 4 years
    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>
  • Hashim Aziz
    Hashim Aziz almost 4 years
    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.
  • Federico
    Federico almost 4 years
    Note that the pc-script.bash script does not escape characters for HTML.
  • automorphic
    automorphic about 3 years
    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!
  • Manfredo
    Manfredo almost 3 years
    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.
  • Tim Abell
    Tim Abell almost 3 years
    Thanks! pdftotext -layout was the magic here. I've made a kdiff3 fork of the script: github.com/timabell/cli-diffpdf/blob/master/cli-diffpdf.sh
  • Fuhrmanator
    Fuhrmanator almost 3 years
    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.
  • OutsideCoder
    OutsideCoder almost 2 years
    Has anyone had their malware scanners alert that xdocdiffPlugin_1_0_6d.zip has malware (Trojan.Malware.300983.susgen)?
  • deasserted
    deasserted over 1 year
    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.