Skip to content

Latest commit

Β 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PDF Comparator β€” local comparison of two files and detection of differences

πŸ‡¬πŸ‡§ English | πŸ‡«πŸ‡· FranΓ§ais

Python License Offline First YouTube LinkedIn

PDF Comparator, Open Source

A simple and local PDF file comparison tool built with Python.

The tool extracts the textual content of two PDF documents, lightly normalizes the data, then displays the differences detected between the two versions.

No AI, no external API, and no file upload to any third-party service.


Structure

pdf-comparator/
β”œβ”€β”€ pdf-compare.py                 β†’ Main PDF comparison script
β”œβ”€β”€ requirements.txt               β†’ Required Python dependencies
β”œβ”€β”€ LICENSE.md                     β†’ MIT License
β”œβ”€β”€ README.md                      β†’ English documentation
β”œβ”€β”€ README_FR.md                   β†’ French documentation
β”‚
└── docs/
    β”œβ”€β”€ images/
    β”‚   β”œβ”€β”€ Palks_Studio.png       β†’ Palks Studio logo
    β”‚   └── pdf_comparator.png     β†’ PDF Comparator presentation image
    β”‚
    β”œβ”€β”€ EN/
    β”‚   β”œβ”€β”€ old.pdf                β†’ Example original PDF in English
    β”‚   β”œβ”€β”€ new.pdf                β†’ Example modified PDF in English
    β”‚   └── compare_pdf_en.mp4     β†’ English demonstration video
    β”‚
    └── FR/
        β”œβ”€β”€ ancien.pdf             β†’ Example original PDF in French
        β”œβ”€β”€ nouveau.pdf            β†’ Example modified PDF in French
        └── compare_pdf_fr.mp4     β†’ French demonstration video

How it works

The principle is intentionally simple:

PDF A ──► Text extraction ──┐
                            β”œβ”€β”€β–Ί Comparison ──► Differences
PDF B ──► Text extraction β”€β”€β”˜

Differences are displayed directly in the terminal, showing added and removed lines.

Example:

--- old.pdf
+++ new.pdf

-Address: 12 Example Street
+Address: 24 Example Street

-Total: €1,200
+Total: €1,350

Features

  • Local comparison of two PDF files
  • Text extraction across all pages
  • Lightweight content normalization before comparison
  • Detection of added and removed lines
  • No artificial intelligence
  • No external API
  • No document transfer
  • Minimal dependency
  • Command-line usage

Requirements

  • Python 3
  • pypdf

Installation

Clone the repository:

git clone REPOSITORY_URL
cd pdf-comparator

Install the dependency:

python -m pip install -r requirements.txt

Examples and demonstration

The repository includes example files that can be used to test PDF Comparator directly.

Two sets are available in the docs/ directory, in English and French. Each version includes two PDF files containing differences, along with a short video showing their comparison using the tool.

These files provide a quick way to explore how the comparator works before using it with your own documents.


Usage

Run the comparator and provide the two PDF files:

python pdf-compare.py old.pdf new.pdf

The first file is considered the reference version, while the second file is the new version to compare.

If no textual difference is detected:

FR: Aucune diffΓ©rence dΓ©tectΓ©e.
EN: No differences detected.

Otherwise, the detected differences are displayed directly in the terminal.


Limitations

PDF Comparator compares the textual content extracted from the documents.

It does not visually compare page rendering, images, fonts, colors, or graphical layout.

The quality of the comparison also depends on the text that can actually be extracted from the PDF. A document containing only images, or a scanned document without an exploitable text layer, cannot be compared correctly.

The tool does not perform any business interpretation of the content and does not attempt to determine the meaning of the detected differences.


Privacy

Files are processed locally on the user's machine.

PDF Comparator does not use any remote service or external API, and documents are never sent to a server.


Project purpose

This project provides an intentionally lightweight solution for quickly identifying textual differences between two versions of a PDF document, without relying on an external platform or artificial intelligence system.

It can be used to review changes in documentation, reports, technical documents, or different versions of the same file.


License

This project is distributed under the MIT License.

Β© Palks Studio β€” see LICENSE.md

About

πŸ‡¬πŸ‡§ Local PDF text comparison tool in Python. No AI, no API, no file upload. πŸ‡«πŸ‡· Comparateur local de fichiers PDF en Python. Sans IA, sans API, sans envoi de fichiers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages