From ae7eec591b690a012f5695ddaa4981f2a1714b49 Mon Sep 17 00:00:00 2001 From: Simon Chupin Date: Thu, 11 Apr 2019 11:55:16 +0200 Subject: [PATCH] fix: Listen for textlayerrendered events from eventBus --- src/app/pdf-viewer/pdf-viewer.component.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/pdf-viewer/pdf-viewer.component.ts b/src/app/pdf-viewer/pdf-viewer.component.ts index c1c893b71..b141120e9 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.ts +++ b/src/app/pdf-viewer/pdf-viewer.component.ts @@ -250,11 +250,6 @@ export class PdfViewerComponent implements OnChanges, OnInit, OnDestroy { }, 100); } - @HostListener('textlayerrendered', ['$event']) - onTextLayerRendered(e: CustomEvent) { - this.textLayerRendered.emit(e); - } - get pdfLinkService(): any { return this._showAll ? this.pdfMultiPageLinkService @@ -331,6 +326,10 @@ export class PdfViewerComponent implements OnChanges, OnInit, OnDestroy { this.pageRendered.emit(e); }); + eventBus.on('textlayerrendered', e => { + this.textLayerRendered.emit(e); + }); + this.pdfMultiPageLinkService = new PDFJSViewer.PDFLinkService({ eventBus }); this.pdfMultiPageFindController = new PDFJSViewer.PDFFindController({ linkService: this.pdfMultiPageLinkService, @@ -364,6 +363,10 @@ export class PdfViewerComponent implements OnChanges, OnInit, OnDestroy { this.pageRendered.emit(e); }); + eventBus.on('textlayerrendered', e => { + this.textLayerRendered.emit(e); + }); + this.pdfSinglePageLinkService = new PDFJSViewer.PDFLinkService({ eventBus });