Skip fieldObjects that are not actually References

The `fieldObjects`-getter is implemented in the `PDFDocument` class, which means that the `this._localIdFactory`-property that we pass to `AnnotationFactory.create` doesn't actually exist.
The reason that this hasn't caused any bugs, that I'm aware of, is that all /Fields-entries need to be References to actually make sense.
This commit is contained in:
Jonas Jenwald 2023-11-08 10:52:56 +01:00
parent 65c827b0eb
commit ff62fc8e2c

View File

@ -1714,7 +1714,10 @@ class PDFDocument {
async #collectFieldObjects(name, fieldRef, promises, annotationGlobals) { async #collectFieldObjects(name, fieldRef, promises, annotationGlobals) {
const { xref } = this; const { xref } = this;
const field = await xref.fetchIfRefAsync(fieldRef); if (!(fieldRef instanceof Ref)) {
return;
}
const field = await xref.fetchAsync(fieldRef);
if (!(field instanceof Dict)) { if (!(field instanceof Dict)) {
return; return;
} }
@ -1731,7 +1734,7 @@ class PDFDocument {
xref, xref,
fieldRef, fieldRef,
annotationGlobals, annotationGlobals,
this._localIdFactory, /* idFactory = */ null,
/* collectFields */ true, /* collectFields */ true,
/* pageRef */ null /* pageRef */ null
) )