Skip to content

Commit 293506a

Browse files
authored
Merge pull request #19903 from Snuffleupagus/shorten-fieldObjects-getter
Shorten the `PDFDocument.prototype.fieldObjects` getter slightly
2 parents ff0d9b1 + 1f7581b commit 293506a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/core/document.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,20 +1823,17 @@ class PDFDocument {
18231823
if (!formInfo.hasFields) {
18241824
return null;
18251825
}
1826-
1827-
const [annotationGlobals, acroForm] = await Promise.all([
1828-
this.pdfManager.ensureDoc("annotationGlobals"),
1829-
this.pdfManager.ensureCatalog("acroForm"),
1830-
]);
1826+
const annotationGlobals = await this.annotationGlobals;
18311827
if (!annotationGlobals) {
18321828
return null;
18331829
}
1830+
const { acroForm } = annotationGlobals;
18341831

18351832
const visitedRefs = new RefSet();
18361833
const allFields = Object.create(null);
18371834
const fieldPromises = new Map();
18381835
const orphanFields = new RefSetCache();
1839-
for (const fieldRef of await acroForm.getAsync("Fields")) {
1836+
for (const fieldRef of acroForm.get("Fields")) {
18401837
await this.#collectFieldObjects(
18411838
"",
18421839
null,

0 commit comments

Comments
 (0)