Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Guides

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
CPDFReaderWidgetController? _controller;

Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(verticalMode: true)),
    onCreated: (controller) {
      setState(() {
        this._controller = 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
CPDFReaderWidgetController? _controller;

Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(displayMode: CPDFDisplayMode.doublePage)),
    onCreated: (controller) {
      setState(() {
        this._controller = 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
CPDFReaderWidgetController? _controller;

Scaffold(
  resizeToAvoidBottomInset: false,
  appBar: AppBar(),
  body: CPDFReaderWidget(
    document: documentPath,
    configuration: CPDFConfiguration(
      readerViewConfig: const ReaderViewConfig(continueMode: true)),
    onCreated: (controller) {
      setState(() {
        this._controller = 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
CPDFReaderWidgetController? _controller;

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

Set the crop mode through CPDFReaderWidgetController:

dart
_controller.setCropMode(true);