Bookmarks

Is their any way to create bookmarks like we create TOC using isInList property for heading.

Hi There,

Thanks for your inquiry.

You can add bookmarks and define its properties using Aspose.Pdf for .NET. However, In order to add bookmarks so that they can behave/look like TOC please check the following code snippet and attached output document.

Document doc = new Document(dataDir + “BookmarksLikeTOC.pdf”);

OutlineItemCollection pdfOutline = new OutlineItemCollection(doc.Outlines);

pdfOutline.Title = "Bookmarks Root";

pdfOutline.Italic = true;

pdfOutline.Bold = true;

pdfOutline.Destination = new GoToAction(doc.Pages[1]);

OutlineItemCollection childOutline = new OutlineItemCollection(doc.Outlines);

childOutline.Title = "Child Bookmark";

childOutline.Italic = true;

childOutline.Bold = true;

childOutline.Destination = new GoToAction(doc.Pages[2]);

pdfOutline.Add(childOutline);

doc.Outlines.Add(pdfOutline);

doc.Save(dataDir + "BookmarksLikeTOC_out.pdf");

For more information you may follow the “Working with Bookmarks” section in the API documentation. In case of any further inquiry please feel free to let us know.

Best Regards,