Metadata-Version: 2.4
Name: groupdocs-merger-net
Version: 26.6.0
Summary: GroupDocs.Merger for Python via .NET - Merge, split, reorder and manipulate document pages
Author-email: GroupDocs <support@groupdocs.com>
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://products.groupdocs.com/merger/python-net/
Project-URL: Documentation, https://docs.groupdocs.com/merger/python-net/
Keywords: merger,merge,split,join,combine,document,pdf,docx,pages,groupdocs,dotnet
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: <3.15,>=3.5
Description-Content-Type: text/markdown

[![banner](https://raw.githubusercontent.com/groupdocs/groupdocs.github.io/master/img/banners/groupdocs-merger-python-net-banner.png)](https://docs.groupdocs.com/merger/python-net/)

[![PyPI](https://img.shields.io/pypi/v/groupdocs-merger-net)](https://pypi.org/project/groupdocs-merger-net/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/groupdocs-merger-net)](https://pypi.org/project/groupdocs-merger-net/)

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

GroupDocs.Merger for Python via .NET is a document-manipulation API for combining and reorganizing documents. Join multiple files into one, split a document into several, and reorder, swap, move, rotate, extract, or remove pages — across Word, Excel, PowerPoint, PDF, Visio, images, eBooks, email, and text formats through one unified API, with no MS Office, OpenOffice, or other external software required. It also manages document passwords, changes page orientation, and renders page previews.

## Get Started

```bash
pip install groupdocs-merger-net
```

```python
from groupdocs.merger import Merger

with Merger("document1.docx") as merger:
    merger.join("document2.docx")
    merger.save("merged.docx")
```

## How It Works

The package is a self-contained Python wheel that bundles the embedded .NET runtime and every native dependency (SkiaSharp, Aspose.Drawing) needed to load, manipulate, and save documents. No external software installation is required — just `pip install` and start merging. The wheel works across Python 3.5 – 3.14 on Windows, Linux, and macOS (Intel + Apple Silicon).

## Features

- **Merge / join** — combine multiple documents of the same family into one; join whole files, page subsets, or images.
- **Split** — break a document into multiple files by page list or interval; split text by lines.
- **Page management** — extract, remove, swap, move, and rotate pages; change page orientation; target odd/even/range subsets.
- **Password protection** — add, change, or remove document passwords; set PDF owner passwords and permissions.
- **Document introspection** — read format, page count, size, and per-page dimensions without a full rebuild.
- **Page previews** — render pages to PNG, JPEG, or BMP via a Python page-stream callback.
- **OLE & attachments** — embed spreadsheets, presentations, diagrams, and PDF attachments.
- **Cross-Platform** — Windows x64/x86, Linux x64, macOS x64/ARM64.

## Common Tasks

- Merge two or more PDFs (or DOCX, XLSX, PPTX) into a single document
- Split a multi-page document into one file per page or per interval
- Extract a subset of pages, or remove unwanted pages
- Reorder a document: swap two pages, move a page, rotate pages
- Add, change, or remove a password on a document
- Read a file's page count, size, and per-page dimensions before processing

## Supported File Formats

For a complete list, see [supported formats](https://docs.groupdocs.com/merger/net/supported-document-formats/).

| Category | Formats |
|---|---|
| **Word Processing** | DOC, DOCX, DOCM, DOT, DOTX, DOTM, ODT, OTT, RTF, TXT |
| **Spreadsheets** | XLS, XLSX, XLSM, XLSB, XLT, XLTX, XLTM, XLAM, ODS, CSV, TSV |
| **Presentations** | PPT, PPTX, PPTM, PPS, PPSX, PPSM, POT, POTX, POTM, ODP, OTP |
| **Fixed-Layout** | PDF, XPS, TEX |
| **Visio Diagrams** | VSD, VSDX, VSDM, VSS, VSSX, VSSM, VST, VSTX, VSTM, VDX, VSX, VTX |
| **Images** | BMP, JPG, JPEG, PNG, GIF, TIF, TIFF, SVG, SVGZ, EMF, EMZ |
| **eBooks & Web** | EPUB, HTML, MHT, MHTML, ONE |

## Examples

### Merge two documents

```python
from groupdocs.merger import Merger

with Merger("document1.docx") as merger:
    merger.join("document2.docx")
    merger.save("merged.docx")
```

### Get document info

```python
from groupdocs.merger import Merger

with Merger("document.pdf") as merger:
    info = merger.get_document_info()
    print("Type:", info.type.file_format)
    print("Pages:", info.page_count)
    print("Size:", info.size, "bytes")
    for page in info.pages:
        print(f"  page {page.number}: {page.width}x{page.height}")
```

### Split a document into single pages

```python
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import SplitOptions

with Merger("multipage.pdf") as merger:
    merger.split(SplitOptions("page_{0}.pdf", [1, 2, 3]))
```

### Extract, remove, and reorder pages

```python
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import (
    ExtractOptions, RemoveOptions, SwapOptions, RotateOptions, RotateMode,
)

with Merger("document.pdf") as merger:
    merger.extract_pages(ExtractOptions([1, 2, 3]))   # keep pages 1-3
    merger.swap_pages(SwapOptions(1, 3))              # swap pages 1 and 3
    merger.rotate(RotateOptions(RotateMode.ROTATE90, [2]))
    merger.save("reordered.pdf")
```

### Add a password

```python
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import AddPasswordOptions

with Merger("document.pdf") as merger:
    merger.add_password(AddPasswordOptions("secret"))
    merger.save("protected.pdf")
```

### Render page previews

```python
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import PreviewOptions, PreviewMode

def create_page_stream(page_number):
    return open(f"page-{page_number}.png", "wb")   # return a file/path stream

with Merger("document.pdf") as merger:
    merger.generate_preview(PreviewOptions(create_page_stream, PreviewMode.PNG, [1, 2]))
```

### Merge from binary streams

```python
import io
from groupdocs.merger import Merger

with open("document1.pdf", "rb") as src:
    with Merger(src) as merger:
        with open("document2.pdf", "rb") as tgt:
            merger.join(tgt)
        buffer = io.BytesIO()
        merger.save(buffer)             # BytesIO is updated after save
        data = buffer.getvalue()
```

## AI Agent & LLM Friendly

This package is designed for seamless integration with AI agents, LLMs, and automated code generation tools.

- **`AGENTS.md` in the package** — AI coding assistants (Claude Code, Cursor, GitHub Copilot) auto-discover the API surface, usage patterns, and troubleshooting tips from the installed package
- **MCP server** — connect your AI tool to GroupDocs documentation for on-demand API lookups:
  ```json
  { "mcpServers": { "groupdocs-docs": { "url": "https://docs.groupdocs.com/mcp" } } }
  ```
- **Machine-readable docs** — full documentation available as plain text for RAG and LLM context:
  - Single file: `https://docs.groupdocs.com/merger/python-net/llms-full.txt`
  - Per page: append `.md` to any docs URL

## Evaluation Mode

The API works without a license in evaluation mode, with these limitations:
- Output is restricted: PDF output carries an evaluation watermark and other formats show an equivalent evaluation mark.
- A page/document-count cap applies to processed documents.

To remove these limitations, apply a license or request a [temporary license](https://purchase.groupdocs.com/temporary-license):

```python
from groupdocs.merger import License
License().set_license("path/to/license.lic")
```

Or set the environment variable (auto-applied at import):
```bash
export GROUPDOCS_LIC_PATH="path/to/license.lic"
```

## Troubleshooting

| Issue | Platform | Fix |
|---|---|---|
| `System.Drawing.Common is not supported` | Linux/macOS | `apt-get install libgdiplus` (Linux) or `brew install mono-libgdiplus` (macOS) |
| `The type initializer for 'Gdip' threw an exception` | macOS | `brew install mono-libgdiplus` |
| Garbled text / missing fonts in output | Linux | `apt-get install ttf-mscorefonts-installer fontconfig && fc-cache -f` |
| `DOTNET_SYSTEM_GLOBALIZATION_INVARIANT` errors | Linux | Do NOT set this variable. ICU must be available. |
| `IncorrectPasswordException` / `PasswordRequiredException` | All | Open with `Merger(path, LoadOptions(password="..."))` |

## System Requirements

- Python 3.5 - 3.14
- Windows x64/x86, Linux x64, macOS x64/ARM64
- No additional software required

## More Resources

- [Documentation](https://docs.groupdocs.com/merger/python-net/)
- [Code Examples](https://github.com/groupdocs-merger/GroupDocs.Merger-for-Python-via-.NET)
- [Free Support Forum](https://forum.groupdocs.com/c/merger)
- [Temporary License](https://purchase.groupdocs.com/temporary-license)

Also available for other platforms:
[.NET](https://products.groupdocs.com/merger/net/) | [Java](https://products.groupdocs.com/merger/java/) | [Node.js](https://products.groupdocs.com/merger/nodejs-java/)

---

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