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

Free Support Forum - aspose.com

Deleting first child bookmark doesn't work properly

I’m creating a document with nested bookmarks. Everything works fine, except when I try to delete the first child bookmark within a nested (parent) bookmark. Even that works fine if I first insert another child, before deleting the first one. Let me illustrate it with the following code sample:

public void testBmDelete1() {
var doc = new Document();
doc.Pages.Add((new Document(“path1”)).Pages);
doc.Pages.Add((new Document(“path2”)).Pages);

// Create the parent bookmark
var parentBm = new OutlineItemCollection(doc.Outlines);
parentBm.Title = “Parent Bookmark”;
parentbm.Open = true;

// Create the child bookmarks
var childBm1 = new OutlineItemCollection(doc.Outlines);
childBm1.Title = “Child Bookmark 1”;
childBm1.Destination = new InteractiveFeatures.GoToAction(doc.Pages.[1]);

// Remove the first child bookmark, this won’t work as intended
doc.Outlines.Delete(“Child Bookmark 1”);

var childBm2 = new OutlineItemCollection(doc.Outlines);
childBm2.Title = “Child Bookmark 2”;
childBm2.Destination = new InteractiveFeatures.GoToAction(doc.Pages.[2]);

// Save the document

This will not work as intended. The second child bookmark doesn’t get inserted. If I move the removing of the first bookmark after the insertion of the second child bookmark, it will work. Also, I tried inserting the first one, then the second one, then removing the second one right after that, and it did what it was supposed to.

Hi Gabor,

Thanks for your inquriy. I have tested the scenario and noticed that deletion of first child bookmark is not working as expected, so logged a ticket PDFNEWNET-40001 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,