PrizmDoc v12.2 - March 9, 2017
Setting 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 Viewing Client 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);

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback