zoomLevel property
double
get
zoomLevel
Zoom level of a document in the SfPdfViewer.
Zoom level value can be set between 1.0 to 3.0. The maximum allowed zoom level is 3.0 and if any value is set beyond that, then it will be restricted to 3.0.
Defaults to 1.0
This example demonstrates how to set the zoom level in the 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;
},
),
],
),
body: SfPdfViewer.asset(
'assets/flutter-succinctly.pdf',
controller: _pdfViewerController,
),
),
);
}
}
Implementation
double get zoomLevel => _zoomLevel;
set
zoomLevel
(double newValue)
Sets the zoom level
Implementation
set zoomLevel(double newValue) {
if (_zoomLevel == newValue) {
return;
}
_zoomLevel = newValue;
_notifyPropertyChangedListeners(property: 'zoomLevel');
}