🇺🇸 Palks Studio is now available in the United States Explore our services →

TECHNICAL RESOURCE · OPEN SOURCE

PDF Comparator to Compare Two PDF Files Locally

PDF Comparator is an open-source tool for comparing the text content of two PDF files locally, making it easy to identify added or removed lines.

PDF Comparator is a local, open-source tool designed to quickly compare the text content of two PDF files.

It extracts text from both documents, applies light normalization and displays the differences detected between the two versions.

The goal is to provide a simple way to identify textual changes in a document without relying on an external platform, API or artificial intelligence system.

Compare Two Versions Without Uploading Files

PDF Comparator runs directly on your machine. Documents are never sent to an external service.

The analysis focuses exclusively on extractable PDF text. It identifies added or removed lines without comparing the visual layout of the documents.

RESOURCE CONTENT

What Does PDF Comparator Include?

Application and Comparison

Main Script pdf-compare.py contains the PDF comparison logic
Text Comparison Detects added and removed lines between two PDF files
Local Processing Comparison runs on your machine, without APIs or file uploads

Documentation and Examples

Bilingual Documentation Complete README documentation available in French and English
Sample PDF Files Original and modified PDF files ready for testing in French and English
Video Demonstrations Two demonstrations showing comparisons using the provided sample files

HOW IT WORKS

How Does the Comparison Work?

Extracting the Content

The pdf-compare.py script extracts the text from the pages of both PDF files provided when it runs.

Light normalization is then applied before comparing the reference document with its updated version.

Detecting Differences

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

If no textual differences are detected, the tool simply reports that no changes were found instead of generating an unnecessary report.

Fully Local Processing

All processing takes place locally, without uploading files to a third-party service or using an external API, an approach consistent with data security principles.

DEMONSTRATION

See PDF Comparator in Action

Demonstration of a local comparison between two PDF files, including text extraction and identification of added or removed lines.

GETTING STARTED

Installation and Usage

The project requires Python 3 and the pypdf library.

  • Install dependencies: python -m pip install -r requirements.txt
  • Compare two PDF files: python pdf-compare.py old.pdf new.pdf

The first file is the reference version. The second is the updated version to compare.

OPEN SOURCE

Limitations and Use Cases

PDF Comparator compares extracted text content. It does not visually compare page rendering, images, fonts, colors or graphical layout.

Comparison quality also depends on the text that can actually be extracted from each PDF. Image-only documents or scanned files without a usable text layer cannot be compared reliably.

The project is open source under the MIT license.

Was this page helpful?

← Back to Resources