From 2a0ad8e696dcf16e9b3617275735299d53dc626f Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 21 Aug 2021 15:30:25 +0200 Subject: [PATCH] Add deprecation warnings for the `renderInteractiveForms` and `includeAnnotationStorage` options, in `PDFPageProxy.render` *This is done separately from the previous patch, to make it easier to revert these changes once they've been included in a couple of releases.* Please note that because these two options are mutually exclusive, which is a large part of the reason for the previous patch, it's not guaranteed that the fallback-values will always be correct in every situation (but it's the best that we can do). --- src/display/api.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/display/api.js b/src/display/api.js index 40fe7599f..865c3bb54 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1350,6 +1350,33 @@ class PDFPageProxy { background = null, optionalContentConfigPromise = null, }) { + if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC")) { + if (arguments[0]?.renderInteractiveForms !== undefined) { + deprecated( + "render no longer accepts the `renderInteractiveForms`-option, " + + "please use the `annotationMode`-option instead." + ); + if ( + arguments[0].renderInteractiveForms === true && + annotationMode === AnnotationMode.ENABLE + ) { + annotationMode = AnnotationMode.ENABLE_FORMS; + } + } + if (arguments[0]?.includeAnnotationStorage !== undefined) { + deprecated( + "render no longer accepts the `includeAnnotationStorage`-option, " + + "please use the `annotationMode`-option instead." + ); + if ( + arguments[0].includeAnnotationStorage === true && + annotationMode === AnnotationMode.ENABLE + ) { + annotationMode = AnnotationMode.ENABLE_STORAGE; + } + } + } + if (this._stats) { this._stats.time("Overall"); }