Click or drag to resize
Pdf Library for .NET

PdfBookmarksCollection Class

Represents the collection of bookmarks in a pdf document (accessed via Bookmarks) or the children of a parent bookmark (accessed via ChildNodes).
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfBookmarksCollection

Namespace: SelectPdf.Universal
Assembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntax
public class PdfBookmarksCollection : IEnumerable<PdfBookmark>, 
	IEnumerable

The PdfBookmarksCollection type exposes the following members.

Properties
 NameDescription
Public propertyCountNumber of bookmarks directly in this collection (children not counted).
Public propertyDocument The parent pdf document of the bookmarks collection. Returns null when this is a child collection of another bookmark.
Public propertyItem Gets the bookmark at the specified zero based index in the bookmarks collection.
Top
Methods
 NameDescription
Public methodCode exampleAdd(String, PdfDestination) Adds a new bookmark to the bookmarks collection.
Public methodAdd(String, Int32) Convenience overload — adds a new bookmark that targets the specified page at its top-left corner.
Public methodAdd(String, Int32, Single, Single) Convenience overload — adds a new bookmark that targets a specific position on a specific page.
Public methodClearRemoves all bookmarks from this collection.
Public methodGetEnumeratorReturns an enumerator that iterates over the top-level bookmarks in this collection.
Public methodCode exampleInsert(Int32, String, PdfDestination) Creates a new bookmark and inserts it at the specified zero based index in the bookmarks collection.
Public methodInsert(Int32, String, Int32) Convenience overload — inserts a new bookmark at the specified index targeting the specified page at its top-left corner.
Public methodInsert(Int32, String, Int32, Single, Single) Convenience overload — inserts a new bookmark at the specified index targeting a specific position on a specific page.
Public methodRemove(PdfBookmark)Removes the specified pdf bookmark.
Public methodRemove(String)Removes the first bookmark in this collection whose text matches the given string.
Public methodRemoveAtRemoves the pdf bookmark at the specified index in the bookmarks collection.
Top
Example
PdfDocument document = new PdfDocument();
document.AddPage();
document.Bookmarks.Add("Chapter 1", 0);
document.Bookmarks.Add("Chapter 2", 0);
document.Save("out.pdf");
document.Close();
See Also