GroupDocs.Merger for .NET

Remove pages in PDF

GroupDocs.Merger for .NET enhances .NET apps with powerful document processing capabilities, including removing pages from PDF files.

How to remove pages from PDF

With GroupDocs.Merger, you can easily delete pages from PDF files. Add document management functionality to your .NET applications effortlessly.

  1. Specify the PDF file path.
  2. Choose the pages to remove.
  3. Perform the removal operation.
  4. Save the modified document.
// Initialize Merger with the file path
using (Merger merger = new Merger("document.pdf"))
{
    // Specify the page number(s) to be removed
    RemoveOptions removeOptions = new RemoveOptions(new int[] { 2 });

    // Apply the removal settings
    merger.RemovePages(removeOptions);

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

Comprehensive document processing

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

Key capabilities of GroupDocs.Merger

Merge multiple file types

Combine PDFs, Word documents, presentations, spreadsheets, images, and archives with flexible options for precise merging.

Organize document pages

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

Customize page layout

Rotate pages at any angle or switch between portrait and landscape orientations as needed.

Extract pages into separate documents

Select and save specific pages as independent files for better document organization.

How to remove all even pages

Learn how to delete even-numbered pages from a PDF document.

C#

// Provide the file path to the constructor
using (Merger merger = new Merger("document.pdf"))
{
    // Get the total page count
    IDocumentInfo info = merger.GetDocumentInfo();
    int lastPage = info.PageCount;

    // Define settings to remove even pages
    RemoveOptions removeOptions = new RemoveOptions(1, lastPage, RangeMode.EvenPages);

    // Process the document
    merger.RemovePages(removeOptions);

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

About GroupDocs.Merger

GroupDocs.Merger for .NET is an advanced document processing tool supporting over 50 file formats, including PDF, Word, Excel, PowerPoint, Visio, images, and archives. It offers a range of features such as merging, splitting, extracting, reordering, swapping, and deleting pages to optimize document management.
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 additional capabilities of our solution.

Remove pages from various file formats

GroupDocs.Merger supports over 50 document formats, allowing quick and easy modifications.

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