Delete a page

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v8)  /  Delete a page

DynamicPDF CoreSuite for .NET (v8) Forum

 Oct 19 2015 10:56 AM
Is it possible to remove a page from a MergeDocument?
 Oct 19 2015 1:03 PM
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.

All times are US Eastern Standard time. The time now is 1:25 AM.