wpf-devexpress-dot-xpf-dot-pdfviewer-dot-pdfviewercontrol-dot-gotobookmark-x28-devexpress-dot-pdf-dot-pdfviewerbookmark-x29.md
Navigates to the specified bookmark.
Namespace : DevExpress.Xpf.PdfViewer
Assembly : DevExpress.Xpf.PdfViewer.v25.2.dll
NuGet Package : DevExpress.Wpf.PdfViewer
public void GoToBookmark(
PdfViewerBookmark bookmark
)
Public Sub GoToBookmark(
bookmark As PdfViewerBookmark
)
| Name | Type | Description |
|---|---|---|
| bookmark | PdfViewerBookmark |
A bookmark to which the PDF Viewer should navigate.
|
Use the Bookmarks property to obtain a list of document bookmarks.
The PdfViewerBookmarkExtensions.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 navigates to a bookmark node with a specific title when the document is loaded. Call the Dispatcher.BeginInvoke method to use the GoToBookmark method in the PdfViewerControl.DocumentLoaded event handler.
private void PdfViewer_DocumentLoaded(object sender, RoutedEventArgs e) {
foreach (var bookmarkItem in pdfViewer.Bookmarks) {
if (bookmarkItem.Title == "Annotations")
Dispatcher.BeginInvoke(new Action(() => pdfViewer.GoToBookmark(bookmarkItem)), DispatcherPriority.ApplicationIdle);
}
}
Private Sub PdfViewer_DocumentLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
For Each bookmarkItem In pdfViewer.Bookmarks
If bookmarkItem.Title = "Annotations" Then
Dispatcher.BeginInvoke(New Action(Sub() pdfViewer.GoToBookmark(bookmarkItem)), DispatcherPriority.ApplicationIdle)
End If
Next bookmarkItem
End Sub
See Also