GroupDocs.Merger for .NET

Page rotation in PDF

GroupDocs.Merger for .NET enhances .NET applications by adding advanced document processing features. Rotate pages in PDF files and work with popular business formats effortlessly.

How to rotate PDF pages

With GroupDocs.Merger, you can easily rotate pages in PDF documents, adding powerful document management capabilities to .NET applications.

  1. Define the source path of the PDF file.
  2. Select the page number to rotate.
  3. Execute the page rotation operation.
  4. Save the modified file to your preferred location.
// Create an instance of Merger and load the source file
using (Merger merger = new Merger("document.pdf"))
{
    // Specify the page number to rotate
    RotateMode rotateMode = RotateMode.Rotate180;
    RotateOptions rotateOptions = new RotateOptions(rotateMode, new int[] { 1 });

    // Execute the page rotation operation
    merger.RotatePages(rotateOptions);

    // Save the output file to the desired location
    merger.Save("result.pdf");
}
dotnet add package GroupDocs.Merger
click to copy
copied
More examples Documentation

Powerful document content management

GroupDocs.Merger for .NET includes a wide range of features, enabling efficient processing of over 50 commonly used business file formats.

Key features of GroupDocs.Merger

Merge different file formats

Combine PDFs, Word documents, presentations, spreadsheets, Visio diagrams, images, and archives. Use various options for precise output.

Manage document pages

Rearrange pages by moving, swapping, or deleting them to structure your documents better.

Adjust page layout

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

Extract pages as separate files

Select a single page or a page range and save it as a new file in a chosen location.

Rotate all even-numbered PDF pages

This example demonstrates how to rotate all even-numbered pages in a PDF document.

C#

// Load the source file into the constructor
using (Merger merger = new Merger("document.pdf"))
{
    // Get the total number of pages in the document
    IDocumentInfo info = merger.GetDocumentInfo();
    int lastPage = info.PageCount;

    // Configure rotation settings for even pages (180 degrees)
    RangeMode rangeMode = RangeMode.EvenPages;
    RotateMode rotateMode = RotateMode.Rotate180;
    RotateOptions rotateOptions = new RotateOptions(rotateMode, 1, lastPage, rangeMode);

    // Apply the page rotation operation
    merger.RotatePages(rotateOptions);

    // Save the output file
    merger.Save("result.pdf");
}
dotnet add package GroupDocs.Merger
click to copy
copied
More examples Documentation

About GroupDocs.Merger

GroupDocs.Merger for .NET is a comprehensive document processing library that supports over 50 file formats, including PDF, Word, Excel, PowerPoint, Visio, images, and archives. It provides tools for merging, splitting, extracting, rearranging, and deleting pages, enhancing document handling 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.

Key features

Explore the powerful features provided by our document processing library.

Rotate pages in multiple formats

GroupDocs.Merger supports over 50 file formats, allowing you to modify documents easily using a variety of 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