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

TECHNICAL RESOURCE · OPEN SOURCE

PDF / XML Comparator to Compare PDF and XML Data Locally

PDF / XML Comparator is an open-source tool that compares data from a PDF file and an XML file locally, helping identify values that cannot be found in one of the two representations.

PDF / XML Comparator is a local, open-source tool designed to compare data contained in a PDF file and an XML file.

It searches for values in both directions to identify those present in one representation but not found in the other.

The goal is to support an initial human review of both files without relying on APIs, external services or artificial intelligence.

Compare Data Without Uploading Files

PDF / XML Comparator runs directly on your machine. Documents are not sent to an external service.

The tool searches for values in both directions, from PDF to XML and from XML to PDF, highlighting differences that may require human review.

RESOURCE CONTENT

What Does PDF / XML Comparator Include?

Application and Comparison

Main Application main.py contains the interface and the comparator's main engine
PDF ↔ XML Comparison Bidirectional search for values across both representations
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
Factur-X Examples Ready-to-test PDF and XML file pairs in French and English
Video Demonstrations Two demonstrations showing comparisons using the provided sample files

HOW IT WORKS

How Does the Comparison Work?

PDF to XML

Values detected in the PDF are searched for in the extracted XML data. When a value cannot be found, it is flagged for further review.

XML to PDF

Values contained in the XML file are also searched for in the text extracted from the PDF.

Normalization and Reporting

Different representations of numbers, dates, spaces and non-breaking spaces are taken into account to reduce false discrepancies. The application then distinguishes PDF values not found in the XML from XML values not found in the PDF.

The extracted PDF text, XML data and comparison report remain visible in the interface to facilitate human review.

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.

ELECTRONIC INVOICING

Working With Factur-X Files

The repository includes French and English examples, each containing a PDF file and its associated Factur-X XML file. These can be used to test the comparator directly.

This type of comparison can help with an initial review of the data contained in both representations of a Factur-X electronic invoice.

A Comparator, Not a Validator

A flagged value does not necessarily indicate an error. PDF / XML Comparator is not a compliance validator: it does not check invoicing standards, XSD schemas, Schematron rules, PDF/A compliance or the legal or accounting validity of a document.

Its purpose is to highlight differences that may require human review. Specialized validation remains necessary when compliance verification is required.

DEMONSTRATION

See PDF / XML Comparator in Action

Demonstration of a local, bidirectional comparison between a PDF file and its associated Factur-X XML file, identifying values missing from either representation.

GETTING STARTED

Installation and Usage

The project requires Python 3. The only external Python dependency currently required is pypdf.

  • Install the dependency: pip install pypdf
  • Launch the application: python main.py

In the interface, select the PDF file followed by the XML file, run the comparison and review the flagged values in the report.

OPEN SOURCE

Limitations and Use Cases

PDF comparison relies on text that can be extracted from the document. Image-based scanned PDFs, documents without extractable text or certain complex PDF structures may produce incomplete results.

The comparator searches for matching values and equivalent representations, but it does not establish a semantic correspondence between a specific PDF field and a specific XML element.

The project is open source under the MIT license.

Was this page helpful?

← Back to Resources