diff --git a/src/app/pdf-viewer/pdf-viewer.component.ts b/src/app/pdf-viewer/pdf-viewer.component.ts index c88dce06..17604c65 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.ts +++ b/src/app/pdf-viewer/pdf-viewer.component.ts @@ -112,6 +112,7 @@ export class PdfViewerComponent private isInitialized = false; private loadingTask?: PDFDocumentLoadingTask | null; private destroy$ = new Subject(); + private awaitingInit: boolean = false; @Output('after-load-complete') afterLoadComplete = new EventEmitter(); @Output('page-rendered') pageRendered = new EventEmitter(); @@ -570,8 +571,9 @@ export class PdfViewerComponent }); } - if (!this.pdfViewer._pages?.length) { + if (!this.pdfViewer._pages?.length && !this.awaitingInit) { // the first time we wait until pages init + this.awaitingInit = true; this.pageInitialized.subscribe(() => { this.updateSize(); })