diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 017e5ae8a..4c28cc6b6 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -2515,6 +2515,15 @@ class PartialEvaluator { return; } + const globalImage = self.globalImageCache.getData( + xobj, + self.pageIndex + ); + if (globalImage) { + resolveXObject(); + return; + } + xobj = xref.fetch(xobj); } diff --git a/src/core/image_utils.js b/src/core/image_utils.js index 5625f5b08..17ae9bf7c 100644 --- a/src/core/image_utils.js +++ b/src/core/image_utils.js @@ -247,13 +247,14 @@ class GlobalImageCache { if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { return null; } - if (!this._imageCache.has(ref)) { + const imageData = this._imageCache.get(ref); + if (!imageData) { return null; } // Ensure that we keep track of all pages containing the image reference. pageIndexSet.add(pageIndex); - return this._imageCache.get(ref); + return imageData; } setData(ref, data) {