mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-27 09:27:20 +02:00
Merge pull request #19903 from Snuffleupagus/shorten-fieldObjects-getter
Shorten the `PDFDocument.prototype.fieldObjects` getter slightly
This commit is contained in:
commit
293506ada7
@ -1823,20 +1823,17 @@ class PDFDocument {
|
|||||||
if (!formInfo.hasFields) {
|
if (!formInfo.hasFields) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
const annotationGlobals = await this.annotationGlobals;
|
||||||
const [annotationGlobals, acroForm] = await Promise.all([
|
|
||||||
this.pdfManager.ensureDoc("annotationGlobals"),
|
|
||||||
this.pdfManager.ensureCatalog("acroForm"),
|
|
||||||
]);
|
|
||||||
if (!annotationGlobals) {
|
if (!annotationGlobals) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
const { acroForm } = annotationGlobals;
|
||||||
|
|
||||||
const visitedRefs = new RefSet();
|
const visitedRefs = new RefSet();
|
||||||
const allFields = Object.create(null);
|
const allFields = Object.create(null);
|
||||||
const fieldPromises = new Map();
|
const fieldPromises = new Map();
|
||||||
const orphanFields = new RefSetCache();
|
const orphanFields = new RefSetCache();
|
||||||
for (const fieldRef of await acroForm.getAsync("Fields")) {
|
for (const fieldRef of acroForm.get("Fields")) {
|
||||||
await this.#collectFieldObjects(
|
await this.#collectFieldObjects(
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user