mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-29 10:27:21 +02:00
Merge pull request #21630 from calixteman/fix/formInfo-inherited-document-signatures
Detect inherited signature fields in form info
This commit is contained in:
commit
d246a6c495
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user