Delete PDF Pages programmatically C#

The following code snippet also work with Aspose.PDF.Drawing library.

You can delete pages from a PDF file using Aspose.PDF for .NET. To delete a particular page from the PageCollection collection.

Delete Page from PDF File

  1. Call the Delete method and specify the page’s index
  2. Call the Save method to save the updated PDF file The following code snippet shows how to delete a particular page from the PDF file using C#.
// For complete examples and data files, please go to
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Pages();

// Open document
Document pdfDocument = new Document(dataDir + "DeleteParticularPage.pdf");

// Delete a particular page

dataDir = dataDir + "DeleteParticularPage_out.pdf";
// Save updated PDF