From ac75b10be1a5098343cde80e64105c4be8798d0e Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 24 Jul 2026 21:43:32 +0200 Subject: [PATCH] Detect inherited signature fields in form info --- src/core/document.js | 5 ++++- test/unit/document_spec.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/core/document.js b/src/core/document.js index 46e51ad43..f883add41 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -1194,7 +1194,10 @@ class PDFDocument { recursionDepth ); } - const isSignature = isName(field.get("FT"), "Sig"); + const isSignature = isName( + getInheritableProperty({ dict: field, key: "FT" }), + "Sig" + ); const rectangle = field.get("Rect"); const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0); diff --git a/test/unit/document_spec.js b/test/unit/document_spec.js index de0de169d..f926ef0d4 100644 --- a/test/unit/document_spec.js +++ b/test/unit/document_spec.js @@ -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 () { function makeSigDict({ byteRange,