Класс PdfBookmarkCollection
Представляет коллекцию PdfBookmark.
Вот пример, показывающий, как найти закладку PDF по имени закладки:
''' <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
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5