We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document.Pages.Delete(int[] pages) doesn't work prior to 6.7


We use Aspose version 6.6 and I can’t delete pages from a document. Here is the code :

using (Document document = new Document(msRapportComplet))
int [] pagesToDelete = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };

The document has over 30 pages but it’s still throw an ArgumentOutOfRangeException.

This seems to work in version 6.7, but we cannot use version 6.7 because of this other bug <a href="https://forum.aspose.com/t/99492

Is there a way to patch this quickly?

Hi Guillaume,

Thanks for using our products.

I am very sorry for the inconvenience caused due to this issue. However, we would appreciate if you continue with the latest version of Aspose.Pdf for .NET v6.7 because it would be very difficult to fix the issue in Aspose.Pdf for .NET v6.6. Our development team is working on the new issue you are facing in Aspose.Pdf v6.7 and trying to provide the fix the earliest possible. Please spare us some time.

Moreover, you can use the below code to delete the single page using Aspose.Pdf for .NET v6.6, kindly check if it fits your need.

//open document
Document pdfDocument = new Document(@"d:\pdffiles\input.pdf");
//delete a particular page
//save updated PDF

We apologize for your inconvenience.

Thanks & Regards,

I bet you guys are trying to fix the issue as fast as possible, but how long does that usually take? I’m asking because we might have to evaluate other options if it takes too long…

We are releasing our application soon, so I would appreciate if you can give me an estimate.


Hi Guillaume,

Thanks for contacting support.

Adding more to Rashid’s comments, please note that our development team is working hard to fix the other issue that you have reported and as soon as we have some status updates/ETA, we would be more than happy to update you with the status of correction. Please be patient and spare us little time.

As suggested by Rashid, single page can be deleted. So in order to accomplish your requirement, you can add the page numbers in an array element and then iterate through individual array element and delete the specific page from PDF file.

Besides using Document Class, you may also consider using PdfFileEditor class to remove the pages from PDF document. Please visit the following link for information on Delete PDF Pages Using File Paths (Facades) and Delete PDF Pages Using Streams (Facades)

In case you still encounter any issue, please share the source PDF document so that we can test the scenario at our end. We are really sorry for your inconvenience.

Hi Nayyer,

I used the PdfFileEditor class and it worked.

Thanks for the help!