From c9eaf13ae49cad7c22bf3cde4592cd3ca6ab4edc Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 28 Jul 2026 16:04:05 +0200 Subject: [PATCH] Lookup more data in parallel in the `PDFDocument.prototype.#parseSignatureDict` method --- src/core/document.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index 9d6348253..778308952 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -2114,10 +2114,26 @@ class PDFDocument { return null; } - const [filterName, subFilterName] = await Promise.all([ + const [ + filterName, + subFilterName, + t, + name, + reason, + location, + contactInfo, + m, + ] = await Promise.all([ sigDict.getAsync("Filter"), sigDict.getAsync("SubFilter"), + field.getAsync("T"), + sigDict.getAsync("Name"), + sigDict.getAsync("Reason"), + sigDict.getAsync("Location"), + sigDict.getAsync("ContactInfo"), + sigDict.getAsync("M"), ]); + const filter = filterName instanceof Name ? filterName.name : null, subFilter = subFilterName instanceof Name ? subFilterName.name : null; @@ -2127,15 +2143,6 @@ class PDFDocument { } else if (subFilter === "adbe.pkcs7.sha1") { signatureType = 1; } - - const [t, name, reason, location, contactInfo, m] = await Promise.all([ - field.getAsync("T"), - sigDict.getAsync("Name"), - sigDict.getAsync("Reason"), - sigDict.getAsync("Location"), - sigDict.getAsync("ContactInfo"), - sigDict.getAsync("M"), - ]); const refKey = fieldRef instanceof Ref ? fieldRef.toString() : "inline"; return {