Skip to content
DemoAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub
React Native Guides Zooming

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}
    onSaveDocument={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
    },
});