Skip to content
ComPDF
Guides

Configure Page Zoom Behavior

Page zoom controls the display scale of a PDF inside the viewer. Zoom configuration is commonly used in the following scenarios:

  • setting a default magnification level for the first screen
  • switching to a specific zoom level in a business workflow
  • controlling double-tap zoom behavior

This page focuses on programmatic zoom configuration and the basic double-tap zoom setting.

Use this page when

Zoom configuration is commonly needed in the following cases:

  • the default text size in a document is too small and the initial reading scale needs to be increased
  • a specific page must be enlarged to inspect details, such as drawings, tables, or receipts
  • the viewer must keep or disable double-tap zoom behavior explicitly

Set the page zoom ratio

CPDFReaderView supports setting the current page zoom ratio directly through setScale(...).

java
readerView.setScale(5);

This code sets the viewer to a 5x display scale.

If the screen must enter a specific magnification level right after the document is shown, this method is usually called after the document is bound and the viewer becomes interactive.

Enable double-tap zoom

If the viewer should keep double-tap zoom interaction, enable setEnableDoubleClickScale(...).

java
readerView.setEnableDoubleClickScale(true);

After it is enabled, double-tapping the page changes the display scale according to the SDK's current zoom behavior.

Combine zoom settings

Zoom configuration is often used together with the default reading mode. For example, a document can enter a specific display mode first, then apply a zoom ratio, while still keeping double-tap zoom interaction.

java
readerView.setScale(5);
readerView.setEnableDoubleClickScale(true);

This combination is suitable for screens that need magnified reading detail while still preserving standard reading gestures.

Keep these points in mind

  • setScale(...) changes the current viewer display scale. It does not modify the PDF file on disk.
  • Higher zoom ratios increase the visible detail of the page, but reduce the visible area.
  • If the screen already depends on gesture zoom or double-tap zoom behavior, programmatic zoom should be applied at a predictable point in the workflow.
  • Zoom configuration is often used together with Display Modes so that scroll direction, page layout, and scale are controlled together.