Skip to content

Commit 36fafbc

Browse files
committed
Use object destructuring a bit more in the src/core/document.js file
1 parent 92b065c commit 36fafbc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/core/document.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ class PDFDocument {
13631363
hasXfa: false,
13641364
hasSignatures: false,
13651365
};
1366-
const acroForm = this.catalog.acroForm;
1366+
const { acroForm } = this.catalog;
13671367
if (!acroForm) {
13681368
return shadow(this, "formInfo", formInfo);
13691369
}
@@ -1403,22 +1403,22 @@ class PDFDocument {
14031403
}
14041404

14051405
get documentInfo() {
1406+
const { catalog, formInfo, xref } = this;
1407+
14061408
const docInfo = {
14071409
PDFFormatVersion: this.version,
1408-
Language: this.catalog.lang,
1409-
EncryptFilterName: this.xref.encrypt
1410-
? this.xref.encrypt.filterName
1411-
: null,
1410+
Language: catalog.lang,
1411+
EncryptFilterName: xref.encrypt?.filterName ?? null,
14121412
IsLinearized: !!this.linearization,
1413-
IsAcroFormPresent: this.formInfo.hasAcroForm,
1414-
IsXFAPresent: this.formInfo.hasXfa,
1415-
IsCollectionPresent: !!this.catalog.collection,
1416-
IsSignaturesPresent: this.formInfo.hasSignatures,
1413+
IsAcroFormPresent: formInfo.hasAcroForm,
1414+
IsXFAPresent: formInfo.hasXfa,
1415+
IsCollectionPresent: !!catalog.collection,
1416+
IsSignaturesPresent: formInfo.hasSignatures,
14171417
};
14181418

14191419
let infoDict;
14201420
try {
1421-
infoDict = this.xref.trailer.get("Info");
1421+
infoDict = xref.trailer.get("Info");
14221422
} catch (err) {
14231423
if (err instanceof MissingDataException) {
14241424
throw err;

0 commit comments

Comments
 (0)