From 36fafbc05cd5f62e15ac674b43020ee16b4608aa Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 7 May 2025 13:41:50 +0200 Subject: [PATCH] Use object destructuring a bit more in the `src/core/document.js` file --- src/core/document.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index 588031965..508a42d22 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -1363,7 +1363,7 @@ class PDFDocument { hasXfa: false, hasSignatures: false, }; - const acroForm = this.catalog.acroForm; + const { acroForm } = this.catalog; if (!acroForm) { return shadow(this, "formInfo", formInfo); } @@ -1403,22 +1403,22 @@ class PDFDocument { } get documentInfo() { + const { catalog, formInfo, xref } = this; + const docInfo = { PDFFormatVersion: this.version, - Language: this.catalog.lang, - EncryptFilterName: this.xref.encrypt - ? this.xref.encrypt.filterName - : null, + Language: catalog.lang, + EncryptFilterName: xref.encrypt?.filterName ?? null, IsLinearized: !!this.linearization, - IsAcroFormPresent: this.formInfo.hasAcroForm, - IsXFAPresent: this.formInfo.hasXfa, - IsCollectionPresent: !!this.catalog.collection, - IsSignaturesPresent: this.formInfo.hasSignatures, + IsAcroFormPresent: formInfo.hasAcroForm, + IsXFAPresent: formInfo.hasXfa, + IsCollectionPresent: !!catalog.collection, + IsSignaturesPresent: formInfo.hasSignatures, }; let infoDict; try { - infoDict = this.xref.trailer.get("Info"); + infoDict = xref.trailer.get("Info"); } catch (err) { if (err instanceof MissingDataException) { throw err;