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.
This commit is contained in:
Jonas Jenwald 2021-04-06 13:40:15 +02:00
parent 72ef183085
commit 737a8e846d

View File

@ -958,6 +958,12 @@ class PDFDocumentProxy {
* {Uint8Array} containing the full data of the saved document. * {Uint8Array} containing the full data of the saved document.
*/ */
saveDocument() { saveDocument() {
if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
arguments.length > 0
) {
deprecated("saveDocument no longer accepts any options.");
}
if ( if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
this._transport.annotationStorage.size <= 0 this._transport.annotationStorage.size <= 0
@ -1241,6 +1247,16 @@ class PDFPageProxy {
includeAnnotationStorage = false, includeAnnotationStorage = false,
optionalContentConfigPromise = null, 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) { if (this._stats) {
this._stats.time("Overall"); this._stats.time("Overall");
} }