Metadata-Version: 2.1
Name: groupdocs-comparison-net
Version: 25.12
Summary: GroupDocs.Comparison for Python via .NET is a powerful API to compare over 50 types of documents and images, including all Microsoft Office and OpenDocument file formats, PDF documents, raster images (TIFF, JPEG, GIF, PNG, BMP). Retrieve the list of changes in the desired format with a line-by-line comparison of content, paragraphs, characters, styles, shapes, and position.
Home-page: https://products.groupdocs.com/comparison
Author: GroupDocs
License: Other/Proprietary License
Keywords: comparison,compare-files,documents-changes,pdf,docx,xlsx,pptx,html,png,word,excel,powerpoint,visio,opendocument,slides
Platform: macos_arm64
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.5,<3.14
Description-Content-Type: text/markdown

# File Comparison Python API

[Product Page](https://products.groupdocs.com/comparison/python-net/) | [Docs](https://docs.groupdocs.com/comparison/python-net/) | [Demos](https://products.groupdocs.app/comparison/family) | [API Reference](https://reference.groupdocs.com/comparison/) | [Blog](https://blog.groupdocs.com/category/comparison/) | [Search](https://search.groupdocs.com/) | [Free Support](https://forum.groupdocs.com/c/comparison) | [Temporary License](https://purchase.groupdocs.com/temporary-license)

## Powerful Python API for Document Comparison

[**GroupDocs.Comparison for Python via .NET**](https://products.groupdocs.com/comparison/python-net/) lets you easily **compare Word, Excel, PDF, PowerPoint, images, HTML, and more** directly from Python.  
It detects differences at **paragraph, word, character, and formatting levels** and produces clear visual or textual comparison results.  

Use it to build Python apps that **highlight changes between document versions, verify content, and ensure document integrity**.

Without having to install any 3rd party component, you can use GroupDocs.Comparison to build different types applications. For example, GroupDocs, using its own APIs, developed a [free web application](https://products.groupdocs.app/comparison/pdf) that allows people to compare their PDF documents online.

> GroupDocs.Comparison for Python requires you to use python programming language. For Node.js, Java and .NET languages, we recommend you get [GroupDocs.Comparison for Node.js](https://products.groupdocs.com/comparison/nodejs-java/), [GroupDocs.Comparison for Java](https://products.groupdocs.com/comparison/java/) and [GroupDocs.Comparison for .NET](https://products.groupdocs.com/comparison/net/), respectively.

### Key Features

1. **[Accurate Document Comparison](https://docs.groupdocs.com/comparison/python-net/compare-documents/)**  
   - Detect changes in text, formatting, styles, images, tables, and more.  
   - Highlight modifications clearly for quick review.  

2. **[JSON Files Comparison](https://docs.groupdocs.com/comparison/python-net/compare-json-documents/)**  
   - Compare JSON documents with high accuracy, including nested objects, arrays, and data types.  
   - Identify structural and value-level differences with both visual (HTML) and textual (inline JSON diff) outputs.  
   - Highlight additions, deletions, and modifications clearly to simplify data validation and analysis.  

3. **[Advanced Loading](https://docs.groupdocs.com/comparison/python-net/load-file-from-local-disk/)**  
   - Load files from local disk or streams.  
   - Support password-protected documents.  
   - Load custom fonts for accurate rendering.  

4. **[Compare Multiple Protected Documents](https://docs.groupdocs.com/comparison/python-net/compare-multiple-documents-protected-by-password/)**  
   - Enable programmatic comparison of several encrypted documents at once.  
   - Support batch processing for faster workflows.  

5. **[Set Document Metadata on Save](https://docs.groupdocs.com/comparison/python-net/set-document-metadata-on-save/)**  
   - Set metadata in the output document from source, target, or custom values.  
   - Ensure consistent and customizable metadata during comparison.  
   
## Installation

```bash
pip install groupdocs-comparison-net
```

Or upgrade:

```bash
pip install --upgrade groupdocs-comparison-net
```

## Download Package from Official Website

To download the GroupDocs.comparison package for your operating system, please visit the official [GroupDocs Releases website](https://releases.groupdocs.com/comparison/python-net/). Currently, four OS-specific packages are available:

- **Windows 64-bit:** Package name ends with `amd64.whl`
- **Linux 64-bit:** Package name ends with `arm64.whl`
- **macOS Intel Silicon:** Package name ends with `x86_64.whl`

Choose the appropriate package based on your system's architecture.

### Copy Downloaded File

Copy the downloaded file into your project folder.

### Install Package Using Pip

To install package run the command specific to your your operation system. 

Windows 64-bit

```bash
py -m pip install groupdocs_comparison_net-25.12-py3-none-win_amd64.whl
```

Linux 64-bit

```bash
py -m pip install groupdocs_comparison_net-25.12-py3-none-macosx_10_14_x86_64.whl
```

macOS Intel Silicon

```bash
python3 -m pip install groupdocs_comparison_net-25.12-py3-none-manylinux1_x86_64.whl
```

Expected output:

```bash
Processing groupdocs_comparison_net-25.12-py3-none-*.whl
Installing collected packages: groupdocs-comparison-net
Successfully installed groupdocs-comparison-net-25.12
````

## Quick Start Example

Compare two PDF files in Python:

```python

from groupdocs.comparison import Comparer

with Comparer("source.pdf") as comparer:
    comparer.add("target.pdf")
    comparer.compare("result.pdf")

print("Comparison complete. Output saved as result.pdf")
```

## Supported Microsoft Office Formats

**Microsoft Word:** DOC, DOCM, DOCX, DOT, DOTM, DOTX\
**Microsoft Excel:** XLS, XLT, XLSX, XLTM, XLSB, XLSM, XLSX, CSV\
**Microsoft PowerPoint:** POT, POTX, PPS, PPSX, PPTX, PPT\
**Microsoft OneNote:** ONE\
**Microsoft Visio:** VSDX, VSD, VSS, VST, VDX

## Other Supported Formats

**OpenDocument:** ODT, ODP, OTP, ODS, OTT\
**Fixed Layout:** PDF\
**AutoCAD:** DWG, DXF\
**Email:** EML, EMLX, MSG\
**Images:** BMP, GIF, JPG, JPEG, PNG\
**Web:** HTM, HTML, MHT, MHTML \
**Text:** RTF, TXT\
**eBook:** MOBI, DjVu\
**Medical Imaging:** DCM\
**Programming Language:** CS, JAVA, CPP, JS, PY, RB 

See the [full list of supported formats](https://docs.groupdocs.com/comparison/python-net/supported-document-formats/).

## Usage Scenarios

- Compare contract versions in **PDF or DOCX**.  
- Verify spreadsheet changes in **Excel XLSX** files.  
- Detect formatting edits in **PowerPoint** presentations.  
- Highlight pixel-level differences in **PNG or TIFF images**.  
- Automate **QA document review workflows** in Python apps.


## Compare JSON Files and get list of changes via Python

Produce a **merged JSON file** with inline diff markers:\
- Deleted content is wrapped in `[ ]`\
- Inserted content is wrapped in `( )`

```python
import groupdocs.comparison as gc
from groupdocs.comparison.options import CompareOptions

source_path = "source.json"
target_path = "target.json"
result_path = "result.json"

options = CompareOptions()
options.detect_style_changes = True
options.show_deleted_content = True

with gc.Comparer(source_path) as comparer:
    comparer.add(target_path)
    comparer.compare(result_path, options)
```

## Compare multiple documents

The following code snippet shows how to compare several password-protected documents from a local disk(from stream also available).
**Note:** This feature is available only for Word documents, PowerPoint, and Open Document presentations.

```python
import groupdocs.comparison as gc

def compare_multiple_documents(source_path, target_paths, result_path, output_directory, output_file_name):

    # Initialize the comparer with the source file
    comparer = gc.Comparer(source_path)

    # Add target files
    for target_path in target_paths:
        comparer.add(target_path)

    # Set comparison options and save options
    save_options = gc.options.SaveOptions()
    compare_options = gc.options.CompareOptions()

    # Perform the compare operation and save the result
    comparer.compare(output_file_name, save_options, compare_options)

    print(f"\nDocuments compared successfully.\nCheck output in {output_file_name}.")
```

## Get file info for the DOCX file with Python

You can use **GroupDocs.Comparison for Python via .NET** to retrieve detailed metadata about a document before or after comparison.  
The `get_document_info()` method provides information such as file type, total number of pages, file size, and page dimensions.  
This can be helpful for validating files, displaying document details to users, or logging document statistics.

```python
import groupdocs.comparison as gc

source_path = "source.docx"

# Initialize the comparer with the source DOCX file
with gc.Comparer(source_path) as comparer:
    # Retrieve document metadata such as page count and size
    info = comparer.source.get_document_info()

    # Iterate through each page to display detailed information
    for i, page in enumerate(info.pages_info, start=1):
        print(
            f"\nPage number: {i}\n"
            f"File type: {info.file_type}\n"
            f"Number of pages: {info.page_count}\n"
            f"Document size: {info.size} bytes\n"
            f"Width: {page.width}\n"
            f"Height: {page.height}"
        )

```


[Product Page](https://products.groupdocs.com/comparison/python-net/) | [Docs](https://docs.groupdocs.com/comparison/python-net/) | [Demos](https://products.groupdocs.app/comparison/family) | [API Reference](https://reference.groupdocs.com/comparison/) | [Blog](https://blog.groupdocs.com/category/comparison/) | [Search](https://search.groupdocs.com/) | [Free Support](https://forum.groupdocs.com/c/comparison) | [Temporary License](https://purchase.groupdocs.com/temporary-license)

