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

Free Support Forum - aspose.com

Delete bookmarks from PDF using Aspose.PDF for .NET - deleting parent bookmark not updating other values

The deleting operation does not work expected while the document contains parent bookmark and child bookmark.
Please tell me how to delete parent bookmark expected?
See the following code:

       var doc = new Aspose.Pdf.Document();
        doc.Pages.Insert(1);

        // Create parent bookmark1
        var bookmark1 = new OutlineItemCollection(doc.Outlines);
        bookmark1.Title = "Bookmark1";
        doc.Outlines.Add(bookmark1);

        // Create child bookmark2
        var bookmark2 = new OutlineItemCollection(doc.Outlines);
        bookmark2.Title = "Bookmark2";
        bookmark1.Add(bookmark2);

        doc.Save("test.pdf");
        Debug.WriteLine("doc.Outlines.Count : " + doc.Outlines.Count);
        // the output is : doc.Outlines.Count : 1

        // Delete the bookmark1
        doc.Outlines.Delete("Bookmark1");
        doc.Save("test.pdf");

        Debug.WriteLine("doc.Outlines.Count : " + doc.Outlines.Count);
        // the output is : doc.Outlines.Count : 1
        // why still output 1  ?

        foreach (OutlineItemCollection bookmark in doc.Outlines)
        {
            Debug.WriteLine(bookmark.Title);
        }
        // the output is : Bookmark1
        // the deleting operation is not work expected.

@CharlieChu

Thank you for contacting support.

We would like to share with you that the bookmarks are deleted fine from the PDF file, as expected. However, the values are not updated when checked with the properties in your code snippet. Therefore, a ticket with ID PDFNET-44736 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hello,

are there any news or workarounds regarding this issue?

Regards

Mark

@bruegmann

Regretfully, the issue is still pending for resolution due to other high priority issues in the queue. We will surely let you know as soon as we have some definite updates regarding issue resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.