Python 3 Script to Compare Two PDF Documents or Find Difference Using pdf-diff Library Full Project For Beginners

 

 

Welcome folks today in this blog post we will be comparing and finding difference of pdf documents in python using pdf-diff library. All the full source code of the application is shown below.

 

 

 

 

Get Started

 

 

 

In order to get started you need to install the below library using the pip command as shown below

 

 

pip install pdf-diff

 

 

After installing this library you need to make an app.py file and copy paste the following code

 

 

app.py

 

 

from setuptools import setup, find_packages

setup(name='pdf-diff',
      version='0.9.1',
      description='Finds differences between two PDF documents',
      long_description=open("README.md").read(),
      long_description_content_type="text/markdown",
      url='https://github.com/JoshData/pdf-diff',
      author=u'Joshua Tauberer',
      author_email=u'jt@occams.info',
      license='CC0 1.0 Universal',
      packages=find_packages(),
      install_requires=[
          'diff_match_patch_python',
          'lxml',
          'pillow',
      ],
      entry_points = {
        'console_scripts': ['pdf-diff=pdf_diff.command_line:main'],
      },
      zip_safe=False)

 

See also  Python 3 Tkinter COVID-19 Vaccine or Medicine Administration Management System Using MySQL Database GUI Desktop App Full Project For Beginners

 

 

DOWNLOAD FULL SOURCE CODE

 

 

Running

Turn two PDFs into one large PNG image showing the differences:

pdf-diff before.pdf after.pdf > comparison_output.png

 

Leave a Reply