diff --git a/src/display/annotation_storage.js b/src/display/annotation_storage.js index 96e730223..e1b4fac3a 100644 --- a/src/display/annotation_storage.js +++ b/src/display/annotation_storage.js @@ -58,7 +58,7 @@ class AnnotationStorage { */ setValue(key, value) { if (this._storage.get(key) !== value) { - this.setModified(); + this._setModified(); } this._storage.set(key, value); } @@ -74,7 +74,10 @@ class AnnotationStorage { return this._storage.size; } - setModified() { + /** + * @private + */ + _setModified() { if (!this._modified) { this._modified = true; if (typeof this.onSetModified === "function") { diff --git a/src/display/api.js b/src/display/api.js index 453e073a5..f9a295dcc 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -2544,7 +2544,9 @@ class WorkerTransport { filename: this._fullReader ? this._fullReader.filename : null, }) .finally(() => { - annotationStorage.resetModified(); + if (annotationStorage) { + annotationStorage.resetModified(); + } }); } diff --git a/web/app.js b/web/app.js index 949d1c4ad..9bbe26deb 100644 --- a/web/app.js +++ b/web/app.js @@ -1687,6 +1687,10 @@ const PDFViewerApplication = { if (this.printService) { this.printService.destroy(); this.printService = null; + + if (this.pdfDocument) { + this.pdfDocument.annotationStorage.resetModified(); + } } this.forceRendering(); },