Compares two PDF files by appearance, not by content.
Project description
VERSION |
DOWNLOADS |
TESTS |
COVERAGE |
---|---|---|---|
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.
Installation
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
Usage
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.
Similarity
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.
Enjoy it!
Contribute
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pdfcomparator-0-2-0.tar.gz
.
File metadata
- Download URL: pdfcomparator-0-2-0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76df2246b479d5c744419a6eaad06e8ec36b2884848beec81310f77d5f24b9c9 |
|
MD5 | 1539f6f57ed3e677ce768acaeda17d69 |
|
BLAKE2b-256 | 80fd425ea119f150bda3bbf09f08af5eb1e9a46a3a6e1540c175c102cb08989c |
File details
Details for the file pdfcomparator-0_2_0-py2-none-any.whl
.
File metadata
- Download URL: pdfcomparator-0_2_0-py2-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags:
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d4dc2a9b188cdbb902190506bfdb98892b8bdfd7efe403607c0fd4c03de2085 |
|
MD5 | 7eb201010e3673bd978f9c459bf5cc93 |
|
BLAKE2b-256 | 2fa1082027766fb05727b1ac8a204b6181aac7d49919ae4f93ba987d95fbb4a5 |