Posted by a ceTe Software moderator
Hello,
There is no direct method or property to delete the pages in the MergeDocument object. Here is the code sample that shows how to create a new PDF (from an existing PDF) by adding only the pages that you would like to retain.
PdfDocument pdf = new PdfDocument(@"C:\Temp\Input.pdf");
MergeDocument document = new MergeDocument();
//below code appends first page.
document.Append(pdf,1, 1);
//Below code appends all the page starting from 3 leaving 2nd page.
document.Append(pdf,3, pdf.Pages.Count-2);
document.Draw(@"C:\Temp\MyDocument.pdf");
Thanks,
ceTe Software Support Team.