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.

tsx
let config = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    pageScale: 1.0
  }
});
ComPDFKit.openDocument(samplePDF, '', config);

// CPDFReaderView Sample
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
    ref={pdfReaderRef}
    document={samplePDF}
    saveDocument={saveDocument}
    configuration={config}/>

Set the zoom level via the API:

tsx
await pdfReaderRef.current?.setScale(2.0);

Double-Tap Zoom

Starting from version 2.6.0, the PDF viewer supports quickly zooming pages using a double-tap gesture. This feature can be enabled via CPDFConfiguration:

tsx
ComPDFKit.getDefaultConfig({
    readerViewConfig: {
        enableDoubleTapZoom: true
    },
});