GroupDocs.Merger for Python via .NET

Rotate pages in PDF files

Enhance your Python applications with GroupDocs.Merger for Python via .NET, a powerful document processing solution. Rotate pages in PDF and manage various file formats effortlessly.

How to rotate PDF pages

With GroupDocs.Merger, you can rotate pages in PDF documents, bringing powerful document management to Python via .NET applications.

  1. Provide the path to the PDF file.
  2. Choose the page number you want to rotate.
  3. Apply the rotation operation.
  4. Save the modified document to your desired location.
import groupdocs.merger as gm

# Initialize Merger and load the source document
with gm.Merger("document.pdf") as merger:
    
    # Specify the page number for rotation
    rotateMode = gm.domain.options.RotateMode.ROTATE180
    rotateOptions = gm.domain.options.RotateOptions(rotateMode, [1])

    # Execute the rotation process
    merger.rotate_pages(rotateOptions)

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

Comprehensive document management

GroupDocs.Merger for Python via .NET offers a broad set of features, making it easy to handle over 50 commonly used business file formats.

Key capabilities of GroupDocs.Merger

Merge multiple file formats

Combine PDFs, Word documents, spreadsheets, presentations, Visio diagrams, images, and archives. Use advanced options for precise control over the merging process.

Rearrange document pages

Easily move, swap, or remove pages to better organize your files.

Customize page layout

Rotate pages to any angle or switch between landscape and portrait orientation for better readability.

Extract pages as separate files

Select specific pages or a page range and save them as a new document in your preferred location.

Rotate all even-numbered PDF pages

This example demonstrates how to rotate every even-numbered page in a PDF document.

JavaScript

import groupdocs.merger as gm

# Load the source document into the constructor
with gm.Merger("document.pdf") as merger:
  
    # Retrieve the total number of pages
    info = merger.get_document_info()
    lastPage = info.page_count

    # Configure settings to rotate even pages by 180 degrees
    rangeMode = gm.domain.options.RangeMode.EvenPages
    rotateMode = gm.domain.options.RotateMode.ROTATE180
    rotateOptions = gm.domain.options.RotateOptions(rotateMode, 1, lastPage, rangeMode)

    # Execute the rotation operation
    merger.rotate_pages(rotateOptions)

    # Save the modified file
    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 an advanced document processing library that supports over 50 file formats, including PDF, Word, Excel, PowerPoint, Visio, images, and archives. It provides features like merging, splitting, extracting, rearranging, and deleting pages to streamline document management in your applications.
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.

Core features

Discover the powerful capabilities available in our document processing library.

Rotate pages in multiple formats

GroupDocs.Merger supports over 50 file types, allowing you to modify documents quickly with a variety of built-in operations.

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