From 737a8e846d35e146895e409baadaf7b4243c5b54 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 6 Apr 2021 13:40:15 +0200 Subject: [PATCH] Add `deprecated` handling of the now removed `AnnotationStorage` API-parameters These changes are done separately, to make it easier to remove them in the future. --- src/display/api.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/display/api.js b/src/display/api.js index b47718076..917459991 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -958,6 +958,12 @@ class PDFDocumentProxy { * {Uint8Array} containing the full data of the saved document. */ saveDocument() { + if ( + (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && + arguments.length > 0 + ) { + deprecated("saveDocument no longer accepts any options."); + } if ( (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && this._transport.annotationStorage.size <= 0 @@ -1241,6 +1247,16 @@ class PDFPageProxy { includeAnnotationStorage = false, optionalContentConfigPromise = null, }) { + if ( + (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && + arguments[0]?.annotationStorage !== undefined + ) { + deprecated( + "render no longer accepts an `annotationStorage` option, " + + "please use the `includeAnnotationStorage`-boolean instead." + ); + includeAnnotationStorage ||= !!arguments[0].annotationStorage; + } if (this._stats) { this._stats.time("Overall"); }