Skip to content
ComPDF
Guides

Zooming

Set the default zoom factor for displaying the PDF document, which defaults to 1.0 and is limited to the range of 1.0 to 5.0.

dart
CPDFReaderWidgetController? _controller;

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

Setting zoom via CPDFReaderWidgetController:

dart
_controller.setScale(1.0);

Double Tap Zoom

Starting from version 2.6.0, the SDK supports zooming pages using double-tap gestures. This feature can be enabled through CPDFConfiguration:

dart
CPDFConfiguration(
  readerViewConfig: CPDFReaderViewConfig(
    enableDoubleTapZoom: true
  )
)