Skip to main content
All docs
V25.1
  • PdfViewer.GoToBookmark(PdfViewerBookmark) Method

    Navigates to the specified bookmark.

    Namespace: DevExpress.XtraPdfViewer

    Assembly: DevExpress.XtraPdfViewer.v25.1.dll

    NuGet Package: DevExpress.Win.PdfViewer

    Declaration

    public void GoToBookmark(
        PdfViewerBookmark bookmark
    )

    Parameters

    Name Type Description
    bookmark PdfViewerBookmark

    A bookmark to which the PDF Viewer should navigate.

    Remarks

    Use the Bookmarks property to obtain a list of document bookmarks.

    The FindBookmark method allows you to find a bookmark that meets specified criteria. This method can be useful if you need to find a bookmark in a document with a complex bookmark tree.

    The code sample below finds a bookmark with the specified title and navigates to this bookmark when the document is loaded:

    using DevExpress.Pdf;
    using DevExpress.XtraPdfViewer;
    //...
    pdfViewer.DocumentChanged += pdfViewer_DocumentChanged;
    
    private void pdfViewer_DocumentChanged(object sender, PdfDocumentChangedEventArgs e) {
        var bookmark = pdfViewer.Bookmarks.FindBookmark(x => x.Title == "4 Notation");
        if (bookmark != null) { 
            pdfViewer.GoToBookmark(bookmark); 
        }
    }
    

    Example

    The code sample below navigates to a bookmark node with a specific title when the document is loaded:

    using DevExpress.Pdf;
    using DevExpress.XtraPdfViewer;
    using System.Collections.Generic;
    //...
    pdfViewer.DocumentChanged += pdfViewer_DocumentChanged;
    
    // Navigate to the "Annotations" bookmark
    private void pdfViewer_DocumentChanged(object sender, PdfDocumentChangedEventArgs e) {
        foreach (var bookmarkItem in pdfViewer.Bookmarks) {
            if (bookmarkItem.Title == "Annotations") 
                pdfViewer.GoToBookmark(bookmarkItem);
        }
    }
    
    See Also