README.md
1*Note: this repository is provided **as-is** and the code is not being actively
2developed. If you wish to improve it, that's greatly appreciated: please make
3the changes and submit a pull request, I'll gladly merge it or help you out
4with finishing it. However, please do not expect any kind of support, including
5implementation of feature requests or fixes. If you're not a developer and/or
6willing to get your hands dirty, this tool is probably not for you.*
7
8[![Build status](https://ci.appveyor.com/api/projects/status/m6d8n2kcyvk3cqi6?svg=true)](https://ci.appveyor.com/project/vslavik/diff-pdf)
9
10## Usage
11
12diff-pdf is a tool for visually comparing two PDFs.
13
14It takes two PDF files as arguments. By default, its only output is its return
15code, which is 0 if there are no differences and 1 if the two PDFs differ. If
16given the `--output-diff` option, it produces a PDF file with visually
17highlighted differences:
18
19```
20$ diff-pdf --output-diff=diff.pdf a.pdf b.pdf
21```
22
23Another option is to compare the two files visually in a simple GUI, using
24the `--view` argument:
25
26```
27$ diff-pdf --view a.pdf b.pdf
28```
29
30This opens a window that lets you view the files' pages and zoom in on details.
31It is also possible to shift the two pages relatively to each other using
32Ctrl-arrows (Cmd-arrows on MacOS). This is useful for identifying translation-only differences.
33
34See the output of `$ diff-pdf --help` for complete list of options.
35
36
37## Obtaining the binaries
38
39Precompiled version of the tool for Windows is available as part of
40[the latest release](https://github.com/vslavik/diff-pdf/releases/tag/v0.5)
41as a ZIP archive, which contains everything you need to run diff-pdf. It will
42work from any place you unpack it to.
43
44On Mac, if you use [Homebrew](https://brew.sh), you can use it to install diff-pdf with it:
45```
46$ brew install diff-pdf
47```
48On Mac, if you use [Macports](https://macports.org), you can install diff-pdf with:
49```
50$ port install diff-pdf
51```
52On Fedora and CentOS 8:
53```
54$ sudo dnf install diff-pdf
55```
56Precompiled version for openSUSE can be downloaded from the
57[openSUSE build service](http://software.opensuse.org).
58
59
60## Compiling from sources
61
62The build system uses Automake and so a Unix or Unix-like environment (Cygwin
63or MSYS) is required. Compilation is done in the usual way:
64
65```
66$ ./bootstrap
67$ ./configure
68$ make
69$ make install
70```
71
72(Note that the first step, running the `./bootstrap` script, is only required
73when building sources checked from version control system, i.e. when `configure`
74and `Makefile.in` files are missing.)
75
76As for dependencies, diff-pdf requires the following libraries:
77
78- wxWidgets >= 3.0
79- Cairo >= 1.4
80- Poppler >= 0.10
81
82#### CentOS:
83
84```
85$ sudo yum groupinstall "Development Tools"
86$ sudo yum install wxGTK wxGTK-devel poppler-glib poppler-glib-devel
87```
88
89#### Ubuntu:
90
91```
92$ sudo apt-get install make automake g++
93$ sudo apt-get install libpoppler-glib-dev poppler-utils libwxgtk3.0-dev
94```
95
96#### macOS:
97Install Command Line Tools for Xcode:
98
99```
100$ xcode-select --install
101```
102
103and install [Homebrew](https://brew.sh) or [MacPorts](https://www.macports.org) to manage dependencies, then:
104
105```
106$ brew install automake autoconf wxmac poppler cairo pkg-config
107```
108
109or
110
111```
112$ sudo port install automake autoconf wxWidgets-3.0 poppler cairo pkgconfig
113```
114
115Note that many more libraries are required on Windows, where none of the
116libraries Cairo and Poppler use are normally available. At the time of writing,
117transitive cover of the above dependencies included fontconfig, freetype, glib,
118libpng, pixman, gettext, libiconv, libjpeg and zlib.
119
120
121### Compiling on Windows using MSYS + MinGW
122
1231. First of all, you will need working MinGW installation with MSYS2 environment
124and C++ compiler. Install MSYS2 by following [their instructions](https://www.msys2.org).
125
1261. Once installed, launch the MSYS2 MinGW shell. It will open a terminal window;
127type `cd /c/directory/with/diff-pdf` to go to the directory with diff-pdf
128sources.
129
1301. You will need to install additional MSYS components that are not normally
131included with MSYS, using these commands:
132
133 ```
134 $ pacman -Syu
135 $ pacman -S automake autoconf pkg-config make zip
136 $ pacman -S mingw-w64-i686-{gcc,poppler,wxWidgets}
137 ```
138
1391. Build diff-pdf in the same way as in the instructions for Unix above:
140
141 ```
142 $ ./bootstrap # only if building from git repository
143 $ ./configure
144 $ make
145 ```
146
1471. To build a ZIP archive will all DLLs, run
148 ```
149 $ make windows-dist
150 ```
151
152
153## Installing
154
155On Unix, the usual `make install` is sufficient.
156
157On Windows, installation is not necessary, just copy the files somewhere. If
158you built it following the instructions above, all the necessary files will be
159in the created ZIP archive.
160