Product Page | Docs | Demos | API Reference | Blog | Free Support | Temporary License
GroupDocs.Merger for Python via .NET is a document-manipulation API for combining and reorganizing documents. Join files into one, split a document into several, and extract, remove, move, swap or rotate pages in Word, Excel, PowerPoint, PDF, Visio, OneNote, OpenDocument, eBook, web, image, text and archive formats, through one API and with no Microsoft Office or other software installed. It also adds and removes passwords, changes page orientation, renders page previews to files or memory, and its groupdocs-merger command joins and splits documents from the shell.
Get Started
pip install groupdocs-merger-net
from groupdocs.merger import Merger
with Merger("report.docx") as merger:
merger.join("appendix.docx")
merger.save("combined.docx")
Or from the command line:
groupdocs-merger merge report.pdf appendix.pdf -o combined.pdf
How It Works
The package is a self-contained Python wheel (about 150 MB on Windows, 165 MB on Linux and macOS) that bundles the .NET 10 runtime and everything else needed to load, change and save documents. No external software installation is required — just pip install and start merging; pip also installs groupdocs-shared-net, the small package of modules every GroupDocs Python package shares. For an offline install, download both wheels and install them together: pip install --no-index --find-links <folder> groupdocs-merger-net. The wheel works across Python 3.5 – 3.14 on Windows, Linux, and macOS (Intel + Apple Silicon).
Features
- Join: combine whole documents or page ranges. Word documents can start on a new page or run on, spreadsheets can add their worksheets or append their rows below the data, images can be stacked or placed side by side, and documents of different formats can be joined into one PDF.
- Split: one file per page, or a new file at each listed page; text files split by lines.
- Page management: extract, remove, move, swap and rotate pages, change page orientation, and pick the odd or even pages of a range.
- Passwords: add, change or remove a document's password, and open protected documents.
- Document information: format, page count, size and the size of each page.
- Page previews: render pages to PNG, JPEG or BMP, into files or into memory (
io.BytesIO). - Command line:
groupdocs-mergermerges, splits, extracts and removes pages without writing code. - Safe with untrusted documents: images and other resources a document links to are not loaded unless you allow them.
- Cross-Platform: Windows x64, Linux x64, macOS x64/ARM64.
Common Tasks
- Merge PDFs, Word documents, spreadsheets or presentations into one file
- Combine monthly spreadsheets into one sheet, keeping a single header row
- Split a document into one file per page, or into sections at given pages
- Keep only the pages you need, or remove the ones you don't
- Reorder, rotate or swap pages
- Protect a document with a password, or remove one
- Render page thumbnails for a document preview in a web application
- Merge or split documents in a shell script or a CI job
Supported File Formats
For the operations available for each format, see supported 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, POTX, POTM, ODP, OTP |
| Fixed-Layout | PDF, XPS, TEX |
| Visio Diagrams | VSD, VSDX, VSDM, VSS, VSSX, VSSM, VST, VSTX, VSTM, VDX, VSX, VTX |
| Note-taking | ONE |
| eBooks & Web | EPUB, HTML, MHT, MHTML |
| Images | BMP, JPG, JPEG, PNG, GIF, TIF, TIFF, SVG, SVGZ, EMF, EMZ |
| Archives & Audio (join) | ZIP, TAR, 7Z, MP3, WAV |
Platform & Format Support
| Format family | Windows | Linux / macOS |
|---|---|---|
| OneNote (ONE) | Yes | With libgdiplus installed |
| Presentations (PPTX, PPT, PPS, POT*, ODP, OTP) | Yes | Yes; on Linux with fontconfig (libfontconfig1) |
| All other formats | Yes | Yes |
Windows wheels run the Windows build of the engine (GroupDocs.Merger.Net100.Windows); Linux and macOS wheels run its cross-platform build (GroupDocs.Merger.Net100), which does everything without libgdiplus except open OneNote documents. To work with OneNote on Linux or macOS, install it: apt-get install libgdiplus, or brew install mono-libgdiplus.
Examples
Merge documents
from groupdocs.merger import Merger
with Merger("january.pdf") as merger:
merger.join("february.pdf")
merger.join("march.pdf")
merger.save("first-quarter.pdf")
Append spreadsheet rows below the data
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import SpreadsheetJoinMode, SpreadsheetJoinOptions
options = SpreadsheetJoinOptions()
options.mode = SpreadsheetJoinMode.ROWS # instead of adding the worksheets
options.skip_rows = 1 # each joined workbook's header row
with Merger("sales-january.xlsx") as merger:
merger.join("sales-february.xlsx", options)
merger.save("sales.xlsx")
Get document info
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(" page", page.number, ":", page.width, "x", page.height)
Split a document
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import SplitMode, SplitOptions
with Merger("document.pdf") as merger:
# one file per page: page_1.pdf, page_2.pdf
merger.split(SplitOptions("page_{0}.pdf", [1, 2]))
with Merger("document.pdf") as merger:
# a new file at page 2: part_0.pdf holds page 1, part_1.pdf the rest
merger.split(SplitOptions("part_{0}.pdf", [2], SplitMode.INTERVAL))
{0} is the page number with SplitMode.PAGES. With SplitMode.INTERVAL, and in both modes of
TextSplitOptions, it is the part's index, from 0.
Extract, remove, and reorder pages
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import (
ExtractOptions, RemoveOptions, RotateMode, RotateOptions, SwapOptions)
with Merger("document.pdf") as merger:
merger.swap_pages(SwapOptions(1, 2)) # swap pages 1 and 2
merger.rotate(RotateOptions(RotateMode.ROTATE90, [2])) # turn page 2
merger.save("reordered.pdf")
with Merger("document.pdf") as merger:
merger.extract_pages(ExtractOptions([1])) # keep page 1 only
merger.save("first-page.pdf")
with Merger("document.pdf") as merger:
merger.remove_pages(RemoveOptions([1])) # drop page 1
merger.save("without-cover.pdf")
Add a password, and open a protected document
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import AddPasswordOptions, LoadOptions
with Merger("document.pdf") as merger:
merger.add_password(AddPasswordOptions("secret"))
merger.save("protected.pdf")
with Merger("protected.pdf", LoadOptions("secret")) as merger:
print("Pages:", merger.get_document_info().page_count)
Render page previews into memory
import io
from groupdocs.merger import Merger
from groupdocs.merger.domain.options import PreviewMode, PreviewOptions
pages = {} # page number -> io.BytesIO holding a PNG
def create_page(page_number):
pages[page_number] = io.BytesIO()
return pages[page_number]
with Merger("document.pdf") as merger:
merger.generate_preview(PreviewOptions(create_page, PreviewMode.PNG, [1, 2]))
png = pages[1].getvalue()
To write files instead, return open("page-%d.png" % page_number, "wb") from create_page.
Merge streams, and save into memory
import io
from groupdocs.merger import Merger
with open("document1.pdf", "rb") as first, open("document2.pdf", "rb") as second:
with Merger(first) as merger:
merger.join(second)
buffer = io.BytesIO()
merger.save(buffer)
data = buffer.getvalue()
Load the resources a trusted document links to
from groupdocs.merger import Merger
from groupdocs.merger.domain import FileType
from groupdocs.merger.domain.options import LoadOptions
options = LoadOptions(FileType.HTML)
options.skip_external_resources = False # only for documents you trust
with Merger("page.html", options) as merger:
merger.join("page.html")
merger.save("pages.html")
whitelisted_resources allows only the URL prefixes it lists, each an absolute URI such as https://cdn.example.com/. To decide per resource, give LoadOptions.external_resource_handler a function or an object with an on_loading(args) method: set args.skipped to allow or skip args.uri, or put the bytes to use in args.data. The handler has the last word over both settings.
A relative link (<img src="photo.png">) is resolved against the working directory, not the document's folder. Run from the document's folder, or supply the bytes in the handler.
Merge and Split from the Command Line
The package installs a groupdocs-merger command:
groupdocs-merger merge report.pdf appendix.pdf -o combined.pdf
groupdocs-merger merge sales-1.xlsx sales-2.xlsx -o sales.xlsx --sheet-mode rows --skip-rows 1
groupdocs-merger merge scan-1.png scan-2.png -o scans.png --image-layout horizontal
groupdocs-merger split handbook.pdf -o parts --at 3,6 # pages 1-2, 3-5, 6 to the end
groupdocs-merger split handbook.pdf -o pages --pages 1- --name page-{0}.pdf
groupdocs-merger extract contract.pdf -o pages.pdf --pages 2-4,7
groupdocs-merger remove scan.pdf -o odd.pdf --pages 1- --even
python -m groupdocs.merger --version
| Command | What it writes | Options |
|---|---|---|
merge INPUT INPUT... -o OUTPUT |
The documents joined in order. The result keeps the first document's format and extension. | --image-layout vertical|horizontal, --word-mode default|continuous|disable-section-breaks, --sheet-mode worksheets|rows, --skip-rows N, --password |
split INPUT -o FOLDER |
One file per page of --pages LIST, or a new file at each page of --at LIST. A text file splits by lines. |
--name PATTERN ({0}: the page number with --pages, the part's index from 0 with --at and for a text file), --odd, --even, --password |
extract INPUT -o OUTPUT --pages LIST |
Only the listed pages. | --odd, --even, --password |
remove INPUT -o OUTPUT --pages LIST |
The document without the listed pages. | --odd, --even, --password |
Pages count from 1: 1,3,5-7 lists pages, and 5- runs to the last page. --license SOURCE applies a licence file or URL first (GROUPDOCS_LIC_PATH also works). A mistake in the command line exits with code 2 and writes nothing, and a document the engine cannot process exits with code 1.
AI Agent & LLM Friendly
This package is designed for seamless integration with AI agents, LLMs, and automated code generation tools.
AGENTS.mdin 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:
{ "mcpServers": { "groupdocs-docs": { "url": "https://docs.groupdocs.com/mcp" } } }
- GroupDocs.Merger MCP server -- let an agent merge documents and extract pages on your machine, with nothing uploaded: docs.groupdocs.com/merger/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
.mdto any docs URL
- Single file:
Evaluation Mode
The API works without a license in evaluation mode with the following limitations:
- Only the first three pages of a document are processed: a result holds at most three pages, a split writes at most three parts, previews stop at page 3, and
get_document_inforeports at most three pages. - Results carry the notice "Created with evaluation version of GroupDocs.Merger": on every page of a PDF and every slide of a presentation, at the start of a Word document, and on an extra "Evaluation Warning" worksheet in a spreadsheet.
To remove these limitations, apply a license or request a temporary license:
from groupdocs.merger import License
License().set_license("path/to/license.lic")
Or set the environment variable, which is applied at the first Merger call:
export GROUPDOCS_LIC_PATH="path/to/license.lic"
If that licence cannot be applied (an expired subscription, a licence for another product, a
missing file), every Merger call raises LicenseError with the reason until a licence is
applied. Set GROUPDOCS_LIC_STRICT=0 to run in evaluation mode with a LicenseWarning instead.
Troubleshooting
| Issue | Platform | Fix |
|---|---|---|
MissingDependencyException ("A required component is not available ... Install the native library it needs") opening a OneNote document |
Linux/macOS | Install libgdiplus: apt-get install libgdiplus, or brew install mono-libgdiplus. No other format needs it |
The same MissingDependencyException opening a PowerPoint or OpenDocument presentation, naming libaspose.slides.drawing.capi |
Linux | Install fontconfig: apt-get install libfontconfig1 |
FileCorruptedException opening an EPUB, or Value cannot be null. (Parameter 'trueTypeFont') previewing a Visio diagram |
Linux | No font is installed. apt-get install libfontconfig1 brings DejaVu |
Line number should be equal or less than lines count 1 splitting a text file by lines |
Windows | A known issue of engine 26.11: on Windows only CRLF line breaks are counted. Convert the file's LF breaks to CRLF first |
| Text parts start with a byte order mark (U+FEFF) and end their lines with CRLF | All | A known issue of engine 26.11: each part is written as UTF-8 with a byte order mark and CRLF line breaks, whatever the input's. Read it with encoding="utf-8-sig" |
| A red cross where an HTML or MHT document showed an image | All | The image is an external resource, and those are not loaded by default. For a document you trust, set skip_external_resources = False on its LoadOptions, list allowed URL prefixes in whitelisted_resources, or decide per resource with external_resource_handler. A relative link is resolved against the working directory, not the document's folder |
IncorrectPasswordException / PasswordRequiredException |
All | Open the document with its password: Merger(path, LoadOptions("password")) |
| Garbled text or missing fonts in a result or preview, or an EPUB with more pages than on Windows | Linux | Install the fonts the documents use. The Microsoft core fonts give Windows' layout: apt-get install ttf-mscorefonts-installer && fc-cache -f (Debian: enable contrib) |
An Aspose/Drawing/SystemFontCache.xml appears in the working directory |
Linux | The engine's font cache goes there only when ~/.local/share cannot be created, as in a read-only home: the package creates the folder otherwise. Set XDG_DATA_HOME to a writable folder |
The process exits with code 134 and Couldn't find a valid ICU package, with no Python exception |
Linux | Install ICU (apt-get install libicu-dev). Do NOT set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT instead |
RuntimeError: The .NET runtime cannot be used in a process forked after it started (up to 26.6.0: the parent process died with a segmentation fault) |
Linux/macOS | A worker was forked after the parent's first GroupDocs call: multiprocessing with the fork start method, gunicorn --preload, Celery prefork. Use multiprocessing.get_context("spawn"), start the workers before the first call, or drop --preload. uvicorn --workers is safe |
is not a supported wheel on this platform, No matching distribution found for groupdocs-merger-net, or pip installs a version older than 26.12 |
Linux/macOS | The OS is older than the wheel needs (glibc 2.27, macOS 12), or pip is older than 20.3: python -m pip install --upgrade pip. Versions up to 26.6 were tagged for older systems, so an unpinned install falls back to them — and they fail at first use there. On an Intel Mac, a Python built against an old SDK reports macOS 10.16 — use pip 24.1+ or SYSTEM_VERSION_COMPAT=0 pip install groupdocs-merger-net |
System Requirements
- Python 3.5 - 3.14, pip 20.3 or newer
- Windows x64, Linux x64, macOS x64/ARM64 — 64-bit Python only; there is no 32-bit Windows wheel
- Linux: glibc 2.27 or newer (e.g. Ubuntu 18.04+, Debian 10+, RHEL 8+), plus ICU and fontconfig (
apt-get install libicu-dev libfontconfig1).libgdiplusonly for OneNote documents. The Microsoft core fonts (ttf-mscorefonts-installer; on Debian enablecontribfirst) make an EPUB paginate as on Windows. - macOS 12 or newer, Intel or Apple Silicon;
mono-libgdiplusonly for OneNote documents.
Upgrading from 26.6
- Relative output paths are relative to the working directory. 26.6 wrote
merger.save("merged.pdf")into the package's own folder (site-packages/groupdocs/merger/_native/libs/Output/), andSplitOptions("part_{0}.pdf", ...)raised "The path is empty". - Previews and split parts written to an
io.BytesIOhold the output. In 26.6 they stayed empty. A release callback,PreviewOptions(create, release, ...), gets the stream as its second argument:release(page_number, stream). - A misspelled option raises. Assigning an attribute that a class does not have raises
AttributeErrorwith a "Did you mean" hint. 26.6 stored it on the Python object and the engine never saw it:options.use_bookmark = Truedid nothing; the property isuse_bookmarks. - A licence that cannot be applied raises
LicenseErrorat the first Merger call, where 26.6 ran in evaluation mode without a word.GROUPDOCS_LIC_STRICT=0brings evaluation mode back, with aLicenseWarning. - Presentations need no
libgdipluson Linux and macOS. Without it, 26.6 could not join, split, extract or remove pages of, preview or password-protect any PowerPoint file; 26.12 needs it only for OneNote documents. On Linux, presentations need fontconfig instead (apt-get install libfontconfig1). - No font cache in the working directory on Linux. Where
~/.local/sharedid not exist, as in a fresh container, 26.6 left the engine'sAspose/Drawing/SystemFontCache.xmlin the working directory. The package now creates that folder, and the cache goes there. - Resources a document links to are not loaded by default (engine 26.10): an image an HTML page links by a
file:///address was in a 26.6 result, and is a red cross now. Allow them as shown in "Load the resources a trusted document links to". - pip also installs
groupdocs-shared-net, the package ofgroupdocs.pydrawingandgroupdocs.pycorethat every GroupDocs Python package shares. An offline install needs both wheels in one folder. - A file object passed to
Mergerstays open after the call; 26.6 closed it. - The engine is GroupDocs.Merger for .NET 26.11 on its .NET 10 build (
GroupDocs.Merger.Net100.Windowson Windows,GroupDocs.Merger.Net100on Linux and macOS), with the .NET runtime 10.0.15. It adds spreadsheet joins by rows (SpreadsheetJoinOptions), and raisesMissingDependencyExceptionwhen a component a format needs is missing.
More Resources
Also available for other platforms: .NET | Java | Node.js
Product Page | Docs | Demos | API Reference | Blog | Free Support | Temporary License
Metadata
Release files for groupdocs-merger-net 26.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| groupdocs_merger_net-26.12.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for groupdocs_merger_net-26.12.0-py3-none-win_amd64.whl |
| groupdocs_merger_net-26.12.0-py3-none-manylinux_2_27_x86_64.whl | Python 3 | none | Linux glibc 2.27+ x86-64 | Details for groupdocs_merger_net-26.12.0-py3-none-manylinux_2_27_x86_64.whl |
| groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details for groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_x86_64.whl |
| groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_arm64.whl | Python 3 | none | macOS 12.0+ ARM64 | Details for groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_arm64.whl |
Total release size: 642.4 MB
Release files / groupdocs_merger_net-26.12.0-py3-none-win_amd64.whl
| Download URL | groupdocs_merger_net-26.12.0-py3-none-win_amd64.whl |
|---|---|
| Size | 148.8 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ddc8322a79df2948c309bf502e4ca9084edbefcb8906dc7b61078c5046aec294
|
|
BLAKE2b-256 checksum How to use checksums |
e25bb817a2ac3283b9191ab2f8d84f3c7d4a70ae7f014ca326455c0ae816ac6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / groupdocs_merger_net-26.12.0-py3-none-manylinux_2_27_x86_64.whl
| Download URL | groupdocs_merger_net-26.12.0-py3-none-manylinux_2_27_x86_64.whl |
|---|---|
| Size | 164.1 MB |
| Tags | Linux glibc 2.27+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
74e658de4377b693c70992a36cc9108e06f2bb80932549700a5a6f5b93677ef0
|
|
BLAKE2b-256 checksum How to use checksums |
4907fb037eeea0c25b5f19efd9ec4bdb640d802c6da86d25c08e0ff4b32cfcca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_x86_64.whl
| Download URL | groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 166.0 MB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
b6e08fe3b52ebb5a130fb89d93cdb2bda9c63672873a757b52e3390375187b65
|
|
BLAKE2b-256 checksum How to use checksums |
1a0e0bb8a58532b92f84196918813d43f4ad44a1495af61c2300264bfeea224c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_arm64.whl
| Download URL | groupdocs_merger_net-26.12.0-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 163.5 MB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
195afa06ee0bc3071090de0386709fd5ebd2cb0b489ae9fda55e3a8d98386e62
|
|
BLAKE2b-256 checksum How to use checksums |
5b0418c571fe077ddea18eb71fa3781390a30172f1c38e41165c10ae77dd9603
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Security for groupdocs-merger-net 26.12.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.