-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
Hi,
We recently updated to "ng2-pdfjs-viewer" version "18.0.0". After this update, we started encountering an error. We open the PDF viewer in a dialog window, and for the first time, it works correctly. However, when we open the dialog with the PDF viewer again, it starts throwing an exception. Eventually, it displays the PDF properly.
document-viewer.component.ts:18 TypeError: Cannot read properties of null (reading 'location')
at PdfJsViewerComponent.loadPdf (ng2-pdfjs-viewer.mjs:298:53)
at PdfJsViewerComponent.refresh (ng2-pdfjs-viewer.mjs:127:14)
at Object.next (document-viewer.component.ts:16:26)
at ConsumerObserver.next (Subscriber.js:91:33)
at SafeSubscriber._next (Subscriber.js:60:26)
at SafeSubscriber.next (Subscriber.js:31:18)
at Subject.js:34:30
at errorContext (errorContext.js:19:9)
at Subject.next (Subject.js:27:21)
Every time we open dialog with PDF viewer again, number of exception raise up:
After we refresh the page with F5, the first opening of the PDF viewer in dialog window is again without errors.
In the previous version, it was OK. Is anyone else encountering this issue too?
Usage:
<div style="width: 100%; height: 100%; min-height: 750px">
<ng2-pdfjs-viewer #pdfViewer></ng2-pdfjs-viewer>
</div>
@ViewChild('pdfViewer', { static: true }) pdfViewer: any;
@Input() set document(value: Observable<Blob>) {
if (this.pdfViewer && value) {
value.subscribe((response) => {
try {
this.pdfViewer.pdfSrc = response;
this.pdfViewer.refresh();
} catch (error) {
console.error(error);
}
});
}
}
Rezi
Metadata
Metadata
Assignees
Labels
No labels