Zooming


Manual Zooming

You can use -[PSPDFViewController zoomToRect:page:animated:] to zoom to a specific CGRect or -[PSPDFViewController setZoomScale:animated:] to set the zoom scale manually.

Disable Zooming

Zooming can be disabled by setting maximumZoomScale of PSPDFConfiguration to 1. It's important to set this value before creating the view.

Copy
1
2
3
let controller = PSPDFViewController(document: document, configuration: PSPDFConfiguration { builder in
    builder.maximumZoomScale = 1
})
Copy
1
2
3
PSPDFViewController *controller = [[PSPDFViewController alloc] initWithDocument:document configuration:[PSPDFConfiguration configurationWithBuilder:^(PSPDFConfigurationBuilder *builder) {
    builder.maximumZoomScale = 1.0f;
}]];

Zooming Delegate Methods

Start Zooming: pdfViewController:didBeginPageZooming: of PSPDFViewControllerDelegate will be called before the zoom level starts to change.

End Zooming: pdfViewController:didEndPageZooming:atScale: of PSPDFViewControllerDelegate will be called after the zoom level has been changed, either programmatically or manually.

Was this page helpful? We're happy to answer any questions.