Back to Devexpress

PdfViewer.Bookmarks Property

windowsforms-devexpress-dot-xtrapdfviewer-dot-pdfviewer-0d7b3749.md

latest2.6 KB
Original Source

PdfViewer.Bookmarks Property

Returns a list of document bookmarks.

Namespace : DevExpress.XtraPdfViewer

Assembly : DevExpress.XtraPdfViewer.v25.2.dll

NuGet Package : DevExpress.Win.PdfViewer

Declaration

csharp
[Browsable(false)]
public IReadOnlyList<PdfViewerBookmark> Bookmarks { get; }
vb
<Browsable(False)>
Public ReadOnly Property Bookmarks As IReadOnlyList(Of PdfViewerBookmark)

Property Value

TypeDescription
IReadOnlyList<PdfViewerBookmark>

A list of document bookmarks.

|

Remarks

Call the PdfViewer.GoToBookmark(PdfViewerBookmark) method to navigate to a specific bookmark.

The FindBookmark method allows you to find a bookmark that meets the 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:

csharp
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); 
    }
}
vb
Imports DevExpress.Pdf
Imports DevExpress.XtraPdfViewer
'...
Private pdfViewer.DocumentChanged += AddressOf pdfViewer_DocumentChanged

Private Sub pdfViewer_DocumentChanged(ByVal sender As Object, ByVal e As PdfDocumentChangedEventArgs)
    Dim bookmark = pdfViewer.Bookmarks.FindBookmark(Function(x) x.Title = "4 Notation")
    If bookmark IsNot Nothing Then
        pdfViewer.GoToBookmark(bookmark)
    End If
End Sub

See Also

PdfViewer Class

PdfViewer Members

DevExpress.XtraPdfViewer Namespace