fitmodeUpdated Event

Product: PDFTron

Product Version: 8.9

Please give a brief summary of your issue:
In my application, I’d like to ensure that the document fitMode always is set to FitMode.FitWidth. When I load a document, FitMode.FitWidth does in fact set the correct size, however, there are times when a page refresh occurs that sets the document to a different width.

The solution that I looked into was to utilize the fitModeUpdated event as shown below:

		documentViewer.addEventListener('fitModeUpdated', async () => {

However, this solution seems to prevent documents from loading. The document starts to load, but never completes, so I assume this is not the correct approach. My question is whether this is the right path, in which case, what am I overlooking, or whether I should consider something else.


Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Please provide a link to a minimal sample where the issue is reproducible:

Hi dcheli,

Thank you for contacting us regarding Webviewer.

Have you tried the following code?

documentViewer.addEventListener('documentLoaded', () => {

This should allow you to set the document everytime you refresh the page.

Johnny, yes I do have that, in general that works, but there is some odd situation that throws the document into a different size. That’s why I was looking at the other event as a precaution.

Hi dcheli,

I see. Could you provide screenshots/video of the situations that would throw document into a different size?

It would help us to investigate the issue, thank you.