Remove or Delete Pages from Documents in C#

We’ll see how to remove a single page or a collection of specific page numbers from the source document in C# using GroupDocs.Merger for .NET. This is a back-end API that can be integrated into any new or existing .NET application without any dependency.

Does it require any software installation?

Absolutely not. It doesn’t matter if MS Office or any PDF reader is installed on your computer. Using a single GroupDocs.Merger for .NET DLL you can develop a web, console, or desktop application to delete the pages.

Remove Selected Page from PDF using C#

Below are the steps to remove the document page(s) from a PDF document with C# code. Just by changing the document name and extension, we can perform the same operation for the supported document formats.

  • Initialize RemoveOptions class with page numbers to remove.
  • Instantiate Merger object with source document path or stream.
  • Call RemovePages method and pass RemoveOptions object to it.
  • Call Save method and pass desired file path to save the resultant document.

Explore API documentation to learn more about the supported features. You can download or clone this open-source example project for API evaluation. If you face any issue, post it on the forum.