Single document operations

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Merger MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-merger -- dnx GroupDocs.Merger.Mcp --yes
Folders, licensing and more →

GroupDocs.Merger for Python via .NET lets you rearrange, filter, and transform individual pages within a single document — without merging multiple files. Use the operations below to build page-level document processing pipelines entirely in Python.

Available operations

OperationDescription
Move pageRelocate any page to a different position in the page order.
Remove pagesDelete one or more pages from a document.
Split documentSplit a document into separate files by page numbers or page intervals.
Split text fileSplit a plain-text file into multiple files by line numbers.
Extract pagesCreate a new document that contains only selected pages from the source.
Swap pagesExchange the positions of two pages within a document.
Change page orientationSwitch pages between Portrait and Landscape orientation.
Rotate pagesRotate pages by 90, 180, or 270 degrees.

Quick-start example

The snippet below loads a PDF, removes page 2, and saves the result — illustrating the common pattern shared by all single-document operations.

from groupdocs.merger import Merger
from groupdocs.merger.domain.options import RemoveOptions

def quick_remove_page():
    # Load the source document
    with Merger("./input.pdf") as merger:
        # Remove page 2
        merger.remove_pages(RemoveOptions([2]))
        # Save the modified document
        merger.save("./output.pdf")

if __name__ == "__main__":
    quick_remove_page()
Tip
All single-document operations follow the same three-step pattern: load with Merger, call the operation method, then save with merger.save().

API reference