GroupDocs.Merger for Python via .NET

Rearrange pages in PDF

GroupDocs.Merger for Python via .NET enables Python applications to modify page order in PDF documents effortlessly.

How to rearrange PDF pages

GroupDocs.Merger makes it easy to move pages within PDF documents. Upgrade your Python via .NET applications with advanced document management features.

  1. Provide the path to the PDF document.
  2. Select the page number and specify its new position.
  3. Execute the move operation.
  4. Save the modified document.
import groupdocs.merger as gm

# Initialize a Merger object with the source document path
with gm.Merger("document.pdf") as merger:
    
    # Select the page to be moved
    pageNum = 3
    moveTo = 1
    moveOptions = gm.domain.options.MoveOptions(pageNum, moveTo)

    # Reposition the page
    merger.move_page(moveOptions)

    # Save the updated document
    merger.save("result.pdf")
npm i @groupdocs/groupdocs.merger
click to copy
copied
More examples Documentation

Advanced document processing

GroupDocs.Merger for Python via .NET offers a wide range of features to help you handle over 50 popular business document formats efficiently.

Key capabilities of GroupDocs.Merger

Merge documents of different formats

Combine content from PDFs, Word documents, presentations, spreadsheets, images, and archives. Flexible options allow precise document structuring.

Page organization

Rearrange pages within documents by moving, swapping, or deleting them as needed.

Adjust page orientation

Rotate pages to any angle or switch between portrait and landscape modes.

Extract pages as separate documents

Select and extract pages, saving them as independent files.

Move a page to the last position in a document

This example demonstrates how to move a specific page to the end of a PDF document.

JavaScript

import groupdocs.merger as gm

# Set the source file path
with gm.Merger("document.pdf") as merger:
  
    # Retrieve document details and determine the last page number
    info = merger.get_document_info()
    pageNum = 1
    moveTo = info.page_count

    # Configure options with the target page numbers
    moveOptions = gm.domain.options.MoveOptions(pageNum, moveTo)

    # Perform the page move operation
    merger.move_page(moveOptions)

    # Save the modified document
    merger.save("result.pdf")
npm i @groupdocs/groupdocs.merger
click to copy
copied
More examples Documentation

About GroupDocs.Merger

GroupDocs.Merger for Python via .NET is a versatile document processing tool that supports more than 50 file formats, including PDF, Word, Excel, PowerPoint, images, and archives. It provides features for merging, splitting, extracting, moving, swapping, and removing pages.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Merger for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Key features

Explore additional powerful capabilities of our solution.

Rearrange pages in multiple formats

GroupDocs.Merger supports over 50 file formats, providing a flexible solution for document organization.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English