From c84b717773a4280b2a9ff228560a6959638e5d6b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 9 Oct 2022 11:15:09 +0200 Subject: [PATCH] Group the `evaluatorOptions` on the main-thread, when sending "GetDocRequest" Rather than sending all of these parameters individually and then grouping them together on the worker-thread, we can simply handle that in the API instead. --- src/core/worker.js | 14 +------------- src/display/api.js | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/core/worker.js b/src/core/worker.js index 0749e1541..caba9149b 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -405,19 +405,7 @@ class WorkerMessageHandler { ensureNotTerminated(); - const evaluatorOptions = { - maxImageSize: data.maxImageSize, - disableFontFace: data.disableFontFace, - ignoreErrors: data.ignoreErrors, - isEvalSupported: data.isEvalSupported, - isOffscreenCanvasSupported: data.isOffscreenCanvasSupported, - fontExtraProperties: data.fontExtraProperties, - useSystemFonts: data.useSystemFonts, - cMapUrl: data.cMapUrl, - standardFontDataUrl: data.standardFontDataUrl, - }; - - getPdfManager(data, evaluatorOptions, data.enableXfa) + getPdfManager(data, data.evaluatorOptions, data.enableXfa) .then(function (newPdfManager) { if (terminated) { // We were in a process of setting up the manager, but it got diff --git a/src/display/api.js b/src/display/api.js index a4e278a5b..85b61d4b2 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -517,19 +517,21 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { rangeChunkSize: source.rangeChunkSize, length: source.length, }, - maxImageSize: source.maxImageSize, - disableFontFace: source.disableFontFace, docBaseUrl: source.docBaseUrl, - ignoreErrors: source.ignoreErrors, - isEvalSupported: source.isEvalSupported, - isOffscreenCanvasSupported: source.isOffscreenCanvasSupported, - fontExtraProperties: source.fontExtraProperties, enableXfa: source.enableXfa, - useSystemFonts: source.useSystemFonts, - cMapUrl: source.useWorkerFetch ? source.cMapUrl : null, - standardFontDataUrl: source.useWorkerFetch - ? source.standardFontDataUrl - : null, + evaluatorOptions: { + maxImageSize: source.maxImageSize, + disableFontFace: source.disableFontFace, + ignoreErrors: source.ignoreErrors, + isEvalSupported: source.isEvalSupported, + isOffscreenCanvasSupported: source.isOffscreenCanvasSupported, + fontExtraProperties: source.fontExtraProperties, + useSystemFonts: source.useSystemFonts, + cMapUrl: source.useWorkerFetch ? source.cMapUrl : null, + standardFontDataUrl: source.useWorkerFetch + ? source.standardFontDataUrl + : null, + }, } );