Automatically "Fit" Zoom on page scroll?

BigSampleDiffSizeLetter.pdf (201.9 KB)

Sample PDF of multiple page sizes attached, nothing too special about it.

Assume you have 2 pages where Page 1 has width x and Page 2 has width 2x. WebViewer seems to only apply the fit based on the current page when the fitmode is set. So, on page 1, the zoom level would be 100%, but when you scroll to page 2 it would remain 100% and the page would no longer fit the screen. Once on page 2, if you then set fit width again, only then would it update to 50% zoom. This is frustrating to some of our users because our PDFs have varying page sizes and they find themselves needing to zoom in and out across pages.

We’re considering normalizing the page size of the PDFs to eliminate the need for this, but wanted to investigate options for handling this in the viewer. The straightforward solution seems to be to re-update the fitmode on every page change. Is there a more direct solution? If not, would someone mind pointing me in the direction of how to best make these updates (an “on page change” event listener perhaps)?

Hello gsmammarella,

You could implement this with:
listening to the pageNumberUpdated event and then using setFitMode

Best regards,
Tyler Gordon

1 Like