mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-29 10:27:21 +02:00
Detect inherited signature fields in form info
This commit is contained in:
parent
05e100c76e
commit
ac75b10be1
@ -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);
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user