controller property
An object that is used to control the navigation and zooming operations in the SfPdfViewer.
A PdfViewerController is served for several purposes. It can be used
to change zoom level and navigate to the desired page, position and bookmark
programmatically on SfPdfViewer by using the zoomLevel
property and
jumpToPage
, jumpTo
and jumpToBookmark
methods.
This example demonstrates how to use the PdfViewerController of SfPdfViewer.
class MyAppState extends State<MyApp>{
late PdfViewerController _pdfViewerController;
@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.zoom_in,
color: Colors.white,
),
onPressed: () {
_pdfViewerController.zoomLevel = 2;
},
),
IconButton(
icon: Icon(
Icons.arrow_drop_down_circle,
color: Colors.white,
),
onPressed: () {
_pdfViewerController.jumpToPage(5);
},
),
],
),
body: SfPdfViewer.asset(
'assets/flutter-succinctly.pdf',
controller: _pdfViewerController,
),
),
);
}
}
Implementation
final PdfViewerController? controller;