initialPageNumber property

int initialPageNumber
final

Represents the initial page to be displayed when the SfPdfViewer widget is loaded.

Defaults to 1.0

It is recommended not to use both the initialScrollOffset and initialPageNumber properties at the same time. If both properties are defined, then the initialPageNumber will be prioritized over the initialScrollOffset.

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'),
       ),
       body: SfPdfViewer.asset(
         'assets/flutter-succinctly.pdf',
         controller: _pdfViewerController,
         initialPageNumber: 2,
       ),
     ),
   );
 }
}

Implementation

final int initialPageNumber;