VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Tree Namespace / PdfBookmarkCollection Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс PdfBookmarkCollection
    В этом разделе
    Представляет коллекцию PdfBookmark.
    Объектная модель
    PdfBookmark PdfDocument PdfIndirectReference PdfBasicObject PdfBookmarkCollection
    Синтаксис
    'Declaration
    
    <DefaultMemberAttribute("Item")>
    Public NotInheritable Class PdfBookmarkCollection
       Inherits PdfTreeNodeBase
    
    
    [DefaultMember("Item")]
    public sealed class PdfBookmarkCollection : PdfTreeNodeBase
    
    
    [DefaultMember("Item")]
    public __gc __sealed class PdfBookmarkCollection : public PdfTreeNodeBase*
    
    
    [DefaultMember("Item")]
    public ref class PdfBookmarkCollection sealed : public PdfTreeNodeBase^
    
    
    Пример

    Вот пример, показывающий, как найти закладку 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

    Смотрите также