On this page
Page Navigation
When using the CPDFReaderWidget
component to display a PDF, the CPDFReaderWidgetController
can be used to perform the following actions:
Navigate to a Specific Page
dart
await controller.setDisplayPageIndex(pageIndex);
1
Get the Current Page Index
dart
int currentPageIndex = await _controller.getCurrentPageIndex();
1
You can also set a page number listener when using CPDFReaderWidget
to get the current sliding page number in real time.
dart
CPDFReaderWidget(
document: widget.documentPath,
configuration: CPDFConfiguration(),
onCreated: (controller) {
},
onPageChanged: (pageIndex){
debugPrint('pageIndex:${pageIndex}');
},
)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10