PdfBookmarkCollection Class
Represents a PdfBookmark collection.
Here is an example that shows how to find a PDF bookmark by bookmark name:
''' <summary>
''' Finds the bookmark.
''' </summary>
''' <param name="document">The document.</param>
''' <param name="bookmarkTitle">The title of bookmark.</param>
Public Function FindBookmark(document As Vintasoft.Imaging.Pdf.PdfDocument, bookmarkTitle As String) As Vintasoft.Imaging.Pdf.Tree.PdfBookmark
Return FindBookmark(document.Bookmarks, bookmarkTitle)
End Function
''' <summary>
''' Finds the bookmark.
''' </summary>
''' <param name="bookmarks">The bookmarks.</param>
''' <param name="bookmarkTitle">The title of bookmark.</param>
Private Function FindBookmark(bookmarks As Vintasoft.Imaging.Pdf.Tree.PdfBookmarkCollection, bookmarkTitle As String) As Vintasoft.Imaging.Pdf.Tree.PdfBookmark
If bookmarks Is Nothing Then
Return Nothing
End If
For i As Integer = 0 To bookmarks.Count - 1
If bookmarks(i).Title = bookmarkTitle Then
Return bookmarks(i)
End If
Dim result As Vintasoft.Imaging.Pdf.Tree.PdfBookmark = FindBookmark(bookmarks(i).ChildBookmarks, bookmarkTitle)
If result IsNot Nothing Then
Return result
End If
Next
Return Nothing
End Function
/// <summary>
/// Finds the bookmark.
/// </summary>
/// <param name="document">The document.</param>
/// <param name="bookmarkTitle">The title of bookmark.</param>
public Vintasoft.Imaging.Pdf.Tree.PdfBookmark FindBookmark(
Vintasoft.Imaging.Pdf.PdfDocument document, string bookmarkTitle)
{
return FindBookmark(document.Bookmarks, bookmarkTitle);
}
/// <summary>
/// Finds the bookmark.
/// </summary>
/// <param name="bookmarks">The bookmarks.</param>
/// <param name="bookmarkTitle">The title of bookmark.</param>
private Vintasoft.Imaging.Pdf.Tree.PdfBookmark FindBookmark(
Vintasoft.Imaging.Pdf.Tree.PdfBookmarkCollection bookmarks, string bookmarkTitle)
{
if (bookmarks == null)
return null;
for (int i = 0; i < bookmarks.Count; i++)
{
if (bookmarks[i].Title == bookmarkTitle)
return bookmarks[i];
Vintasoft.Imaging.Pdf.Tree.PdfBookmark result =
FindBookmark(bookmarks[i].ChildBookmarks, bookmarkTitle);
if (result != null)
return result;
}
return null;
}
System.Object
 Vintasoft.Imaging.Pdf.Tree.PdfTreeNodeBase
   Vintasoft.Imaging.Pdf.Tree.PdfBookmarkCollection
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5