pageChanged event with v8.0

WebViewer Version: v8.0.1

I am working on migrating from WebViewer v7.x to WebViewer 8.x. Most of my code is working, but the code I had that trapped pageChanged events no longer gets called. Could you please provide some updated information on how to trap the pageChanged event with WebViewer 8.x?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello,

You should be able to listen for the “pageNumberUpdated” event like the following

instance.Core.documentViewer.addEventListener('pageNumberUpdated', (pageNumber) => {
   console.log(`Changed to page ${pageNumber}`)
});

Please let me know if that works for you. If it doesn’t, please provide sample code for what you were doing before in version 7.X and maybe some context on what you were doing (in case there is a bug in 8.0 that only affect some situation). Thank you

Best Regards

Andrew Yip
Software Developer
PDFTron Systems, Inc.

Is there any reason that this didn’t make it into the migration guide for v8 - unless I missed it somewhere.

Hi,

The “pageChanged” event was deprecated a few versions back. It was used in our old UI (version 1 to 3, I believe), before we started using Redact for our UI. For version 4, we deprecated it and stopped using it in the UI part of our codebase (I think we removed it from our guides). We kept the “pageChanged” event in our codebase for a few versions for backward compatibility. In version 8.0, we finally removed that event from our codebase but didn’t include it in our migration guide since it been deprecated for a few version and hadn’t been in any of our guides for a while

In the future we’ll try to include information about us removing deprecated code since that would be breaking change for the users still using them.

Best Regards

Andrew Yip
Software Developer
PDFTron Systems, Inc.

Hi Andrew,

Thanks for the explanation. I didn’t realise that the event had been deprecated.

Kind regards,

David