Use object destructuring a bit more in the src/core/document.js file

This commit is contained in:
Jonas Jenwald 2025-05-07 13:41:50 +02:00
parent 92b065c87e
commit 36fafbc05c

View File

@ -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;