mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-29 10:27:21 +02:00
Merge pull request #21628 from calixteman/fix/pdf-editor-inherited-signature-flags
Preserve inherited signature flags
This commit is contained in:
commit
150fbba6e0
@ -1219,7 +1219,7 @@ class PDFEditor {
|
|||||||
if (!isName(annotationDict.get("Subtype"), "Link")) {
|
if (!isName(annotationDict.get("Subtype"), "Link")) {
|
||||||
if (isName(annotationDict.get("Subtype"), "Widget")) {
|
if (isName(annotationDict.get("Subtype"), "Widget")) {
|
||||||
hasSignatureAnnotations ||= isName(
|
hasSignatureAnnotations ||= isName(
|
||||||
annotationDict.get("FT"),
|
getInheritableProperty({ dict: annotationDict, key: "FT" }),
|
||||||
"Sig"
|
"Sig"
|
||||||
);
|
);
|
||||||
const parentRef = annotationDict.getRaw("Parent") || null;
|
const parentRef = annotationDict.getRaw("Parent") || null;
|
||||||
|
|||||||
@ -7758,6 +7758,33 @@ small scripts as well as for`);
|
|||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("preserves flags for inherited signature fields", async function () {
|
||||||
|
const pdfData = assemblePdf([
|
||||||
|
"1 0 obj\n<< /Type /Catalog /Pages 2 0 R " +
|
||||||
|
"/AcroForm 6 0 R >>\nendobj\n",
|
||||||
|
"2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n",
|
||||||
|
"3 0 obj\n<< /Type /Page /Parent 2 0 R " +
|
||||||
|
"/MediaBox [0 0 100 100] /Annots [4 0 R] >>\nendobj\n",
|
||||||
|
"4 0 obj\n<< /Type /Annot /Subtype /Widget /Rect [0 0 20 10] " +
|
||||||
|
"/Parent 5 0 R >>\nendobj\n",
|
||||||
|
"5 0 obj\n<< /FT /Sig /T (signature) /Kids [4 0 R] >>\nendobj\n",
|
||||||
|
"6 0 obj\n<< /Fields [5 0 R] /SigFlags 3 >>\nendobj\n",
|
||||||
|
]);
|
||||||
|
|
||||||
|
let loadingTask = getDocument({ data: pdfData });
|
||||||
|
let pdfDoc = await loadingTask.promise;
|
||||||
|
const data = await pdfDoc.extractPages([{ document: null }]);
|
||||||
|
expect(countMarker(data, "/SigFlags ")).toEqual(1);
|
||||||
|
await loadingTask.destroy();
|
||||||
|
|
||||||
|
loadingTask = getDocument({ data });
|
||||||
|
pdfDoc = await loadingTask.promise;
|
||||||
|
expect(Object.keys(await pdfDoc.getFieldObjects())).toEqual([
|
||||||
|
"signature",
|
||||||
|
]);
|
||||||
|
await loadingTask.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
it("extract page 2 and check AcroForm Fields T entries", async function () {
|
it("extract page 2 and check AcroForm Fields T entries", async function () {
|
||||||
let loadingTask = getDocument(
|
let loadingTask = getDocument(
|
||||||
buildGetDocumentParams("form_two_pages.pdf")
|
buildGetDocumentParams("form_two_pages.pdf")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user