diff --git a/examples/mobile-viewer/viewer.mjs b/examples/mobile-viewer/viewer.mjs index b6fc15474..9a7e3c592 100644 --- a/examples/mobile-viewer/viewer.mjs +++ b/examples/mobile-viewer/viewer.mjs @@ -19,7 +19,6 @@ if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) { } const TEXT_LAYER_MODE = 0; // DISABLE -const MAX_IMAGE_SIZE = 1024 * 1024; const CMAP_URL = "../../node_modules/pdfjs-dist/cmaps/"; const CMAP_PACKED = true; @@ -57,7 +56,6 @@ const PDFViewerApplication = { // Loading document. const loadingTask = pdfjsLib.getDocument({ url, - maxImageSize: MAX_IMAGE_SIZE, cMapUrl: CMAP_URL, cMapPacked: CMAP_PACKED, }); diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 10393f364..281db147a 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -93,7 +93,6 @@ import { Stream } from "./stream.js"; import { stringToPDFString } from "./string_utils.js"; const DefaultPartialEvaluatorOptions = Object.freeze({ - maxImageSize: -1, disableFontFace: false, ignoreErrors: false, isOffscreenCanvasSupported: false, @@ -570,8 +569,7 @@ class PartialEvaluator { localImageCache, localColorSpaceCache, }) { - const { maxImageSize, ignoreErrors, isOffscreenCanvasSupported } = - this.options; + const { ignoreErrors, isOffscreenCanvasSupported } = this.options; const { dict } = image; const imageRef = dict.objId; @@ -582,15 +580,6 @@ class PartialEvaluator { warn("Image dimensions are missing, or not numbers."); return; } - if (maxImageSize !== -1 && w * h > maxImageSize) { - const msg = "Image exceeded maximum allowed size and was removed."; - - if (!ignoreErrors) { - throw new Error(msg); - } - warn(msg); - return; - } let optionalContent; if (dict.has("OC")) { diff --git a/src/display/api.js b/src/display/api.js index 91cd0e3d8..274985dce 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -151,9 +151,6 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated * PDF data cannot be successfully parsed, instead of attempting to recover * whatever possible of the data. The default value is `false`. - * @property {number} [maxImageSize] - The maximum allowed image size in total - * pixels, i.e. width * height. Images above this value will not be rendered. - * Use -1 for no limit, which is also the default value. * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use * `OffscreenCanvas` in the worker. Primarily used to improve performance of * image conversion/rendering. @@ -255,10 +252,6 @@ function getDocument(src = {}) { const standardFontDataUrl = getFactoryUrlProp(src.standardFontDataUrl); const wasmUrl = getFactoryUrlProp(src.wasmUrl); const ignoreErrors = src.stopAtErrors !== true; - const maxImageSize = - Number.isInteger(src.maxImageSize) && src.maxImageSize > -1 - ? src.maxImageSize - : -1; const isOffscreenCanvasSupported = typeof src.isOffscreenCanvasSupported === "boolean" ? src.isOffscreenCanvasSupported @@ -388,7 +381,6 @@ function getDocument(src = {}) { docBaseUrl, enableXfa, evaluatorOptions: { - maxImageSize, disableFontFace, ignoreErrors, isOffscreenCanvasSupported, diff --git a/web/app_options.js b/web/app_options.js index 71ef08c9b..930f3fa11 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -864,14 +864,6 @@ const defaultOptions = new Map([ kind: OptionKind.API, }, ], - [ - "maxImageSize", - { - /** @type {number} */ - value: -1, - kind: OptionKind.API, - }, - ], [ "pdfBug", {