VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Pdf.Tree Namespace / PdfBookmarkCollection Class
Members Example



In This Topic
    PdfBookmarkCollection Class
    In This Topic
    Represents a PdfBookmark collection.
    Object Model
    PdfBookmarkCollection ClassPdfBookmark Class
    Syntax
    '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 
    Example
    This example 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;
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Pdf.Tree.PdfTreeNodeBase
          Vintasoft.Imaging.Pdf.Tree.PdfBookmarkCollection

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also