The bookmark deleting is not work with the method "OutlineItemCollection.Delete()"


#1

The deleting is not work with the method “OutlineItemCollection.Delete()”. And I don’t want to delete bookmark with “OutlineItemCollection.delete(name)”, because the bookmarks may have the same title name sometimes. is there any way to solve this problem?

        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);
        var bookmark3 = new OutlineItemCollection(doc.Outlines);
        bookmark3.Title = "Bookmark3";
        bookmark3.Action = new GoToAction(1);
        bookmark1.Add(bookmark3);

        doc.Save("test.pdf");

        // Delete the bookmark2
        bookmark2.Delete();
        doc.Save("test.pdf");
       // The "bookmark2" still exists in the pdf document

#2

@CharlieChu

Thank you for contacting support.

We have noticed that the bookmark is not deleted without passing the title of bookmark. Therefore, a ticket with ID PDFNET-46540 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.