Hi! I'm using PDFViewer component on angular material dialog. Happens that if i open the dialog with file, and then i close fastly the dialog, i cant call pdfviewer.unload().
So i think that if i dont call unload, the pdf will keep in cache of backend. How i can force unload document?
I found a workaround: this.pdfViewer.viewerBase.unloadDocument(this.pdfViewer.viewerBase); this method call unload endpoint and caché is cleared. But still one console error: ( I supose that is because pdfRenderPages is not loaded). How i can cancel load? i dont want console error
core.js:6210 ERROR TypeError: Cannot set property 'min' of undefined
at Toolbar$1.updateTotalPage (ej2-pdfviewer.es2015.js:40467)
at PdfViewerBase.initPageDiv (ej2-pdfviewer.es2015.js:30723)
at PdfViewerBase.pageRender (ej2-pdfviewer.es2015.js:28974)
at PdfViewerBase.requestSuccess (ej2-pdfviewer.es2015.js:28900)
at AjaxHandler.loadRequestHandler.onSuccess (ej2-pdfviewer.es2015.js:28830)
at AjaxHandler.successHandler (ej2-pdfviewer.es2015.js:36617)
at AjaxHandler.stateChange (ej2-pdfviewer.es2015.js:36592)
at XMLHttpRequest.httpRequest.onreadystatechange [as __zone_symbol__ON_PROPERTYreadystatechange] (ej2-pdfviewer.es2015.js:36511)
at XMLHttpRequest.wrapFn (zone-evergreen.js:1218)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
<button (click)="unload()">unload</button>
unload() {
var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];
viewer.unload();
}
|
Hi Dhivya, happens that you aren't using angular material dialog. https://stackblitz.com/edit/angular-aqxaqz-rojhsf?file=app%2Fapp.module.ts
As you can see in the stackblitz, when we press open button, and then close inside of dialog (when pdfViewer is loading), so console has an error:
Also, you can see in network panel of chrome DevTools, that when this error happens: "Error: Cannot set property 'min' of undefined", the endpoint unload is not being called, and i suppose that PDF file still in cache of backend.
close() {
setTimeout(() => {
this.matDialog.close();
}, 1000);
}
|