Merge pull request #21630 from calixteman/fix/formInfo-inherited-document-signatures

Detect inherited signature fields in form info
This commit is contained in:
Tim van der Meij 2026-07-26 11:57:59 +02:00 committed by GitHub
commit d246a6c495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 1 deletions

View File

@ -1194,7 +1194,10 @@ class PDFDocument {
recursionDepth recursionDepth
); );
} }
const isSignature = isName(field.get("FT"), "Sig"); const isSignature = isName(
getInheritableProperty({ dict: field, key: "FT" }),
"Sig"
);
const rectangle = field.get("Rect"); const rectangle = field.get("Rect");
const isInvisible = const isInvisible =
Array.isArray(rectangle) && rectangle.every(value => value === 0); Array.isArray(rectangle) && rectangle.every(value => value === 0);

View File

@ -226,6 +226,38 @@ describe("document", function () {
}); });
}); });
it("should get form info when the signature field type is inherited", function () {
const acroForm = new Dict();
acroForm.set("SigFlags", 3);
const widgetRef = Ref.get(11, 0);
const parentRef = Ref.get(10, 0);
const widgetDict = new Dict();
widgetDict.set("Rect", [0, 0, 0, 0]);
widgetDict.set("Parent", parentRef);
const parentDict = new Dict();
parentDict.set("FT", Name.get("Sig"));
parentDict.set("Kids", [widgetRef]);
const xref = new XRefMock([
{ ref: widgetRef, data: widgetDict },
{ ref: parentRef, data: parentDict },
]);
widgetDict.assignXref(xref);
parentDict.assignXref(xref);
acroForm.set("Fields", [parentRef]);
const pdfDocument = getDocument(acroForm, xref);
expect(pdfDocument.formInfo).toEqual({
hasAcroForm: false,
hasSignatures: true,
hasXfa: false,
hasFields: true,
});
});
describe("getSignatures", function () { describe("getSignatures", function () {
function makeSigDict({ function makeSigDict({
byteRange, byteRange,