diff --git a/src/app/pdf-viewer/pdf-viewer.component.ts b/src/app/pdf-viewer/pdf-viewer.component.ts index ae67aed1f..e3cdb1e03 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.ts +++ b/src/app/pdf-viewer/pdf-viewer.component.ts @@ -394,6 +394,12 @@ export class PdfViewerComponent const eventBus = createEventBus(PDFJSViewer); + eventBus.on('pagechanging', e => { + if (e.pageNumber != this._page) { + this.page = e.pageNumber; + } + }); + eventBus.on('pagerendered', e => { this.pageRendered.emit(e); }); diff --git a/src/app/utils/event-bus-utils.ts b/src/app/utils/event-bus-utils.ts index 6cbcda4e5..a051dc852 100644 --- a/src/app/utils/event-bus-utils.ts +++ b/src/app/utils/event-bus-utils.ts @@ -26,9 +26,9 @@ function attachDOMEventsToEventBus(eventBus: any) { }); evt.source.textLayerDiv.dispatchEvent(event); }); - eventBus.on('pagechange', function(evt) { + eventBus.on('pagechanging', function(evt) { const event = document.createEvent('UIEvents'); - event.initUIEvent('pagechange', true, true, window, 0); + event.initUIEvent('pagechanging', true, true, window, 0); event['pageNumber'] = evt.pageNumber; evt.source.container.dispatchEvent(event); });