Compares two PDF files by appearance, not by content.
Compares two PDF files by appearance, not by content. It can be used in the command line, in order to use it inside bigger scripts.
It requires some libraries. In Debian or Ubuntu, you can install them by apt:
# apt-get install libpoppler-glib-dev python-gtk2 python-cairo-dev python-gobject-dev python-gobject
Ensure you have an actual version of gcc, because pycairo will require it (it adds the option -fstack-protector-strong to the compilation options). This library is hard to install, so here you have the command line I use:
$ pip install pycairo==1.8.8 –allow-unverified pycairo –allow-external pycairo
Then you can install it as usual:
$ pip install pdfcomparator
The format is the next one:
$ pdfcompare.py pattern current
It will compare the files under “pattern” and “current”.
If they are equal, it will print nothing. If they are different, it will print the first page that is different and the script will return 2.
Usually, two pages are equal or not. But maybe you only requires a similarity percentage. So, you can use a percentaje. Usually, this makes the comparision slower.
So, it will use different algoritms to check the upper similarity ratio. When any of them fails, the whole comparision fails.
You can enable the precise algoritm by using the option –precise and you can set the similarity ratio with –ratio=0.8, using any number between 0 and 1.
If you want to contribute, please, create a VirtualEnv environment:
$ virtualenv venv --system-site-packages $ . venv/bin/activate
It is important to use the system packages in order to find the python-gobject library.
Now, you should be able to install the pdfcomparator package:
$ python setup.py develop
And to test it:
$ python setup.py test
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pdfcomparator-0.3.0-py2-none-any.whl (7.1 kB)||File type Wheel||Python version 2.7||Upload date||Hashes View hashes|
|Filename, size pdfcomparator-0.3.0.tar.gz (4.9 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for pdfcomparator-0.3.0-py2-none-any.whl