Does PDF.js raise an event as I browse between pages?
Yeah, there is an event named pagechange
.
You can use it like that:
document.addEventListener('pagechange', function(e) {
if (e.pageNumber !== e.previousPageNumber) {
console.log('page changed from ' + e.previousPageNumber + ' to ' + e.pageNumber);
}
});
Open the viewer and drop the code above into the console, and see what happens!
Now in v2.1.233 of pdf.js, the event is pagechanging
.