Skip to content

Display Modes

Scroll direction

The page scroll direction can be either horizontal or vertical.

If verticalMode is true, it indicates vertical scrolling; otherwise, it's horizontal scrolling.

dart
Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(verticalMode: true)),
    onCreated: (controller) {},
  ));

You can also set the scroll direction via CPDFReaderWidgetController:

dart
controller.setVerticalMode(true)

Display Mode

The page display mode can be singlePage, doublePage, or coverPage.

dart
Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(displayMode: CPDFDisplayMode.doublePage)),
    onCreated: (controller) {},
  ));

Set the display mode through CPDFReaderWidgetController

  • singlePage
dart
controller.setDoublePageMode(false);
  • doublePage
dart
controller.setDoublePageMode(true);
  • coverPage
dart
controller.setCoverPageMode(true);

Scrolling Mode

The scrolling mode can be set to continuous scrolling or page flipping mode. When continueMode is true, it represents continuous scrolling; otherwise, it's page flipping scrolling.

dart
Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(continueMode: true)),
    onCreated: (controller) {},
  ));

Setting scroll mode via CPDFReaderWidgetController:

dart
controller.setContinueMode(true);

Crop Mode

To display the document after cropping the blank areas around the PDF, when cropMode is true, it indicates enabling cropping mode; otherwise, it's not cropped.

dart
Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(cropMode: true)),
    onCreated: (controller) {},
  ));

Set the crop mode through CPDFReaderWidgetController:

dart
controller.setCropMode(true);