How do I zoom to a specific value?
Q: How do I zoom to a specific value?
A: You can set the zoom level at any moment with setViewState
.
const state = instance.viewState; const newState = state.set("zoom", yourPreferredZoomValue); instance.setViewState(newState);
If a number value is used, it must be between minimumZoomLevel
and maximumZoomLevel
: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoom