Skip to content

Page Navigation

When using the CPDFReaderWidget component to display a PDF, the CPDFReaderWidgetController can be used to perform the following actions:

dart
await controller.setDisplayPageIndex(pageIndex);

Get the Current Page Index

dart
int currentPageIndex = await _controller.getCurrentPageIndex();

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}');
  },
)