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.
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
:
controller.setVerticalMode(true)
Display Mode
The page display mode can be singlePage
, doublePage
, or coverPage
.
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
controller.setDoublePageMode(false);
- doublePage
controller.setDoublePageMode(true);
- coverPage
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.
Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(),
body: CPDFReaderWidget(
document: documentPath,
configuration: CPDFConfiguration(
readerViewConfig: const ReaderViewConfig(continueMode: true)),
onCreated: (controller) {},
));
Setting scroll mode via CPDFReaderWidgetController
:
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.
Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(),
body: CPDFReaderWidget(
document: documentPath,
configuration: CPDFConfiguration(
readerViewConfig: const ReaderViewConfig(cropMode: true)),
onCreated: (controller) {},
));
Set the crop mode through CPDFReaderWidgetController
:
controller.setCropMode(true);