Finds differences between two PDF documents:
- Compares the text layers of two PDF documents and outputs the bounding boxes of changed text in JSON.
- Rasterizes the changed pages in the PDFs to a PNG and draws red outlines around changed text.
The script is written in Python 3, and it relies on the pdftotext
program.
sudo apt-get install python3-lxml poppler-utils # on Ubuntu, at least
sudo pip3 install pillow lxml diff_match_patch_python
Turn two PDFs into one large PNG image showing the differences:
python3 pdf-diff.py before.pdf after.pdf > test.png