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

Free Support Forum - aspose.com

PdfFileEditor.Delete is returning false

PdfFileEditor.Delete is returning false while I am trying to delete a page from a pdf file,


Is there any way to know, why it is returning false, and what can we do in those scenarios ?

Hi

I don't seem to have this problem with following code when using the current release of Aspose.Pdf for .NET. There are chances that the source file that you are using might be causing this problem.

//create PdfFileEditor object
PdfFileEditor pdfEditor = new PdfFileEditor();
//array of pages to delete
int[] pagesToDelete = new int[] { 2 };
//delete pages
pdfEditor.Delete("c:/input/Original.pdf", pagesToDelete, "c:/input/output.pdf");

Hi Sanjay,

Kindly shared template PDF Document and source code you are using with us if you still facing the problem. This will help us to figure out the issue and reply back to you soon.

We apologize for your inconvenience.

Thanks & Regards,

this is the pdf file from which I am not able to delete the last page.

Hi Sanjay,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I used the following sample code with your shared PDF file and I am able to delete the last page successfully. If you are using some old version of Aspose.Pdf then please download and try the latest version of Aspose.Pdf for .NET and let us know if you still face any issue. Also, I have attached the resultant file for your reference.

//create PdfFileEditor object

PdfFileEditor pdfEditor = new PdfFileEditor();

//array of pages to delete

int[] pagesToDelete = new int[] { 2 };

//delete pages

pdfEditor.Delete(@"E:\14898_1.pdf", pagesToDelete, @"E:\output_del.pdf");

Thank You & Best Regards,