PrizmDoc Viewer v13.9 - Updated
Set the Initial Zoom Factor
Developer Guide > Viewer > How to Customize the Viewer > Set the Initial Zoom Factor

Example Integration

When a document loads, it defaults to the size of the screen. While this ensures all documents fit on the screen, certain documents may be sized too large. To prevent this, you can set an initial zoom of the document before it is displayed. To set a specific scaling factor before the document loads with optimal performance, subscribe to the PageOpening event to set the target scale before PageDisplayed has fired.

The PageOpening event is triggered when a page being opened has reached the point that it has height, width, and resolution data but hasn’t yet been displayed. This example sets the initial zoom of the Viewer at runtime so that it will initialize at 125% zoom factor instead of auto-fit:

Example
Copy Code
function pageOpeningHandler() {
  // Set the initial page zoom to a maximum of 125%
  if (viewerControl.getScaleFactor() > 1.25) {
    viewerControl.setScaleFactor(1.25);
  }
  // Remove the event subscription since we only want to respond to the first PageOpening
  viewerControl.off(PCCViewer.EventType.PageOpening, pageOpeningHandler);
}
viewerControl.on(PCCViewer.EventType.PageOpening, pageOpeningHandler);