Class PdfBookMarkCollection
Represents a PDF bookmark as seen in the sidebar of PDF reader software to help user's navigate.
Implements
Namespace: IronPdf.Bookmarks
Assembly: IronPdf.dll
Syntax
public class PdfBookMarkCollection : PdfClientAccessor, IEnumerable<IPdfBookmark>, IEnumerable, IPdfBookMarkCollection
Properties
Count
Total number of bookmarks, including all nested bookmarks
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FirstBookmark
First bookmark within the bookmark collection at the current level
Declaration
public IPdfBookmark FirstBookmark { get; }
Property Value
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark |
LastBookmark
Last bookmark within the bookmark collection at the current level
Declaration
public IPdfBookmark LastBookmark { get; }
Property Value
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark |
Parent
Bookmark which contains this bookmark collection
Declaration
public IPdfBookmark Parent { get; }
Property Value
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark |
Methods
AddBookMarkAtEnd(String, Int32)
Add a new bookmark at the end of this bookmark collection
Declaration
public IPdfBookmark AddBookMarkAtEnd(string text, int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The display text for the link. |
System.Int32 | pageIndex | The zero based page number to link to. E.g. Page 1 has a PageIndex of 0 |
Returns
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark | Newly added bookmark |
AddBookMarkAtStart(String, Int32)
Add a new bookmark at the start of this bookmark collection
Declaration
public IPdfBookmark AddBookMarkAtStart(string text, int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The display text for the link. |
System.Int32 | pageIndex | The zero based page number to link to. E.g. Page 1 has a PageIndex of 0 |
Returns
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark | Newly added bookmark |
GetAllBookmarks()
Retrieve all bookmarks within this collection, recursively retrieve all children of bookmarks within this collection, and return a flat list
Declaration
public List<IPdfBookmark> GetAllBookmarks()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronPdf.Bookmarks.IPdfBookmark> | A flattened list of all bookmarks in this collection and all of their children |
GetBookmarkAfter(IPdfBookmark)
Retrieve the next bookmark after the specified bookmark at the current level
Declaration
public IPdfBookmark GetBookmarkAfter(IPdfBookmark previousBookmark)
Parameters
Type | Name | Description |
---|---|---|
IronPdf.Bookmarks.IPdfBookmark | previousBookmark | Previous bookmark |
Returns
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark | Next bookmark at the current level |
GetBookmarkBefore(IPdfBookmark)
Retrieve the previous bookmark before the specified bookmark at the current level
Declaration
public IPdfBookmark GetBookmarkBefore(IPdfBookmark nextBookmark)
Parameters
Type | Name | Description |
---|---|---|
IronPdf.Bookmarks.IPdfBookmark | nextBookmark | Next bookmark |
Returns
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark | Previous bookmark at the current level |
GetEnumerator()
Declaration
public IEnumerator<IPdfBookmark> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<IronPdf.Bookmarks.IPdfBookmark> |
InsertBookMarkAfter(String, Int32, IPdfBookmark)
Insert a new bookmark after the specified bookmark
Declaration
public IPdfBookmark InsertBookMarkAfter(string text, int pageIndex, IPdfBookmark previousBookmark)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The display text for the link. |
System.Int32 | pageIndex | The zero based page number to link to. E.g. Page 1 has a PageIndex of 0 |
IronPdf.Bookmarks.IPdfBookmark | previousBookmark | Bookmark after which to insert a new bookmark |
Returns
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark |
InsertBookMarkBefore(String, Int32, IPdfBookmark)
Insert a new bookmark before the specified bookmark
Declaration
public IPdfBookmark InsertBookMarkBefore(string text, int pageIndex, IPdfBookmark nextBookmark)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The display text for the link. |
System.Int32 | pageIndex | The zero based page number to link to. E.g. Page 1 has a PageIndex of 0 |
IronPdf.Bookmarks.IPdfBookmark | nextBookmark | Bookmark before which to insert a new bookmark |
Returns
Type | Description |
---|---|
IronPdf.Bookmarks.IPdfBookmark |
RemoveBookMark(IPdfBookmark)
Removes the specified bookmark from this bookmark collection
Declaration
public void RemoveBookMark(IPdfBookmark bookmark)
Parameters
Type | Name | Description |
---|---|---|
IronPdf.Bookmarks.IPdfBookmark | bookmark | The bookmark object to remove. |
RemoveBookMarkAt(Int32)
Removes a bookmark at the specified index from this bookmark collection or any of its children
Declaration
public void RemoveBookMarkAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the bookmark to remove. |