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

Free Support Forum - aspose.com

Throw exception number of placed objects is not correct after delete page via Aspose.PDF

Description

When I delete a page of a PDF, an exception was thrown: Number of placed objects is not correct.

Code

void Main()
{
    var doc = new Aspose.Pdf.Document(@"C:\Users\XCL\Desktop\pdf\source.pdf");
    doc.Pages.Delete(2);
    doc.Optimize(); // If remove this line, it's OK. Because of the page of deleted maybe is too large, so I must to call this line.
    doc.Save(@"C:\Users\XCL\Desktop\pdf\target.pdf");
}

Test File

source.pdf (81.7 KB)

@xucongli1989

We have logged this problem in our issue tracking system as PDFNET-53337. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.