Handle pdf errors when changing docs
This commit is contained in:
parent
3dc5213527
commit
2a36c82762
@ -465,8 +465,14 @@ export class PdfViewerComponent
|
|||||||
|
|
||||||
this.clear()
|
this.clear()
|
||||||
|
|
||||||
|
if (this.pdfViewer) {
|
||||||
|
this.pdfViewer._resetView()
|
||||||
|
this.pdfViewer = null
|
||||||
|
}
|
||||||
|
|
||||||
this.setupViewer()
|
this.setupViewer()
|
||||||
|
|
||||||
|
try {
|
||||||
this.loadingTask = PDFJS.getDocument(this.getDocumentParams())
|
this.loadingTask = PDFJS.getDocument(this.getDocumentParams())
|
||||||
|
|
||||||
this.loadingTask!.onProgress = (progressData: PDFProgressData) => {
|
this.loadingTask!.onProgress = (progressData: PDFProgressData) => {
|
||||||
@ -492,6 +498,9 @@ export class PdfViewerComponent
|
|||||||
this.onError.emit(error)
|
this.onError.emit(error)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
this.onError.emit(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private update() {
|
private update() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user