GroupDocs.Merger for .NET

Swap PDF pages

GroupDocs.Merger for .NET extends .NET applications with advanced document management capabilities. Easily rearrange pages in PDF files to structure content exactly as needed.

How to rearrange PDF pages

With GroupDocs.Merger, you can easily reorganize pages in PDF documents to enhance readability and structure. Add efficient document processing to your .NET applications.

  1. Provide the path to the PDF file.
  2. Select the pages to be swapped or reordered.
  3. Apply the appropriate method to modify the document.
  4. Save the updated file to the specified location.
// Load the document into Merger
using (Merger merger = new Merger("document.pdf"))
{
    // Specify the pages to be swapped
    SwapOptions swapOptions = new SwapOptions(1, 2);

    // Execute the swap operation
    merger.SwapPages(swapOptions);

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

Advanced document handling

GroupDocs.Merger for .NET provides a complete set of tools for seamless document modification, supporting over 50 formats.

Key functionalities of GroupDocs.Merger

Merge different document types

Combine PDFs, Word files, spreadsheets, presentations, Visio drawings, images, and archive files. Customize the output to match specific requirements.

Organize document structure

Rearrange content by moving, swapping, or deleting pages, ensuring documents are well-structured and easy to navigate.

Adjust page orientation

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

Extract selected pages

Choose and extract specific pages or page ranges to create a new, refined document.

Swap the first and last pages in a PDF file

This example demonstrates how to swap pages in a PDF file in a few simple steps.

C#

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

    // Define swap settings with page numbers
    SwapOptions swapOptions = new SwapOptions(1, lastPage);

    // Execute the swap operation
    merger.SwapPages(swapOptions);

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

GroupDocs.Merger capabilities

GroupDocs.Merger for .NET is a comprehensive document processing library that supports 50+ file formats, including PDFs, Word documents, Excel spreadsheets, PowerPoint presentations, Visio diagrams, images, and archives. Integrate it into your applications to merge, split, extract, reorder, swap, and delete pages across various document types.
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.

Main features

Explore the core capabilities of our document processing library.

Rearrange pages in multiple file formats

GroupDocs.Merger supports over 50 file types, giving you full control over document content.

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