In the previous version of DynamicPDF (3.x), we used the RemoveAt method on the PageList class to remove pages from documents. As of 4.x this method doesn't seem to be available anymore, so our application won't compile without making some code changes.
Was this method removed intentionally? If so, what is the new best practice for removing pages from documents?
Thanks
PageList.RemoveAt() method - missing in 4.x?
Re: PageList.RemoveAt() method - missing in 4.x?
Support · Jul 25, 2006Hello,
Yes, the RemoveAt method of the PageList object has been removed in v4.0. In order to remove a page from the document you will have to use overloaded MergeDocument constructor which takes the starting page and the number of pages to merge. For e.g. if you have 10 page document and you want to remove page number 5, please look at the code below:
C# Code:
PdfDocument pdf = new PdfDocument("filePath\DocumentA.pdf");
MergeDocument document = new MergeDocument( pdf, 1, 4 );
document.Append(pdf, 6, 5);
document.Draw( @"C:\Temp\HelloWorld.pdf" );
VB.NET Code:
Dim MyPdfDocument As New PdfDocument("filePath/DocumentA.pdf")
Dim MyDocument As New MergeDocument(MyPdfDocument, 1, 4)
MyDocument.Append(MyPdfDocument, 6, 5)
MyDocument.Draw("C:\Temp\HelloWorld.pdf")
Thanks,
ceTe Software Support Team