Skip to main content

Compares two PDF files by appearance, not by content.

Project description

VERSION

DOWNLOADS

TESTS

COVERAGE

Latest PyPI version

Number of PyPI downloads

Travis results

Coveralls results_

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfcomparator-0.3.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

pdfcomparator-0.3.0-py2-none-any.whl (7.1 kB view details)

Uploaded Python 2

File details

Details for the file pdfcomparator-0.3.0.tar.gz.

File metadata

File hashes

Hashes for pdfcomparator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9a41e675475de8ff26d39fdc752830dc358f171f590130fbe89cbb30270c37af
MD5 f557ba1110ea2ff11a911bcdd9ebe63a
BLAKE2b-256 c5634a08aa9ffb2363945bae30204d2dbf8fb6a5ef71acb9ddc5dcf832f7f3ad

See more details on using hashes here.

File details

Details for the file pdfcomparator-0.3.0-py2-none-any.whl.

File metadata

File hashes

Hashes for pdfcomparator-0.3.0-py2-none-any.whl
Algorithm Hash digest
SHA256 51c93d949558cad3cb77ecf0341256c50fe3fe0ba03cd5ebaa60eeeab83dafdd
MD5 1840a9292e3265bcb40fc69efd370139
BLAKE2b-256 dfbbf3bf9c25dd9227a5e2fd78cebd58f0509c4820b3795b264a61ed59ddf76b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page