Single document operations

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