Creating new events in the viewer API of PDF.js for better integration with other libraries

I continued to work on PDF.js. This time around I created new events within the viewer API that help better integrate PDF.js with other libraries.

First event that I created is called

pageremoved

Pageremoved was needed so an external library can know exactly when a page is removed from cache. This can be useful if said library wants to release any resources that are associated with that page.

Next event is

documentloaded

This event is pretty self-explanatory. It fires when a document is fully loaded. It can be useful for libs that want to wait to load in resources until the document is loaded.

Last event is

metadataloaded

This event fires when the metadata has been fully loaded. Again useful for libs that need to know if the metadata has been loaded before trying to access any of it.

The code can be found at the following PR: https://github.com/mozilla/pdf.js/pull/5915/files

Advertisements