jumpToBookmark method

void jumpToBookmark(
  1. PdfBookmark bookmark
)

Navigates to the specified bookmark location in a PDF document.

Using this method, the SfPdfViewer navigates to the specified PdfBookmark location in a PDF document. If the specified bookmark location is wrong, then the navigation will not happen and the older page location will be retained.

  • bookmark - required - The bookmark location to which the SfPdfViewer should navigate to.

Returns null.

This example demonstrates how to navigate to the specified bookmark location.

class MyAppState extends State<MyApp>{
late PdfViewerController _pdfViewerController;
late PdfBookmark _pdfBookmark;

 @override
 void initState(){
   _pdfViewerController = PdfViewerController();
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       appBar: AppBar(
          title: Text('Syncfusion Flutter PdfViewer'),
          actions: <Widget>[
             IconButton(
                icon: Icon(
                   Icons.arrow_drop_down_circle,
                   color: Colors.white,
                ),
                onPressed: () {
                   _pdfViewerController.jumpToBookmark(_pdfBookmark);
                },
             ),
          ],
       ),
       body: SfPdfViewer.asset(
         'assets/flutter-succinctly.pdf',
         controller: _pdfViewerController,
         onDocumentLoaded: (PdfDocumentLoadedDetails details){
            _pdfBookmark = details.document.bookmarks[0];
         },
       ),
     ),
   );
 }
}

Implementation

void jumpToBookmark(PdfBookmark bookmark) {
  _pdfBookmark = bookmark;
  _notifyPropertyChangedListeners(property: 'jumpToBookmark');
}