summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2024-04-22 14:22:08 +0200
committerAlbert Astals Cid <aacid@kde.org>2024-04-23 09:18:13 +0000
commitfe9fe140aee72a41a2add7db7f7b0dae7cb55700 (patch)
treeb3fa96cf02588cc2043121714bfdad0f3210f855
parenteac1adcbc2246fd1ad22e8336d050a71cbf03804 (diff)
signing: Fix modifying the AcroForm dict when it's embedded in the Catalog
-rw-r--r--poppler/Catalog.cc1
-rw-r--r--poppler/PDFDoc.cc2
2 files changed, 3 insertions, 0 deletions
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 2e3dbd5b..56da8b5c 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -1118,6 +1118,7 @@ void Catalog::setAcroFormModified()
if (acroFormRef != Ref::INVALID()) {
xref->setModifiedObject(&acroForm, acroFormRef);
} else {
+ catDict.dictSet("AcroForm", acroForm.copy());
xref->setModifiedObject(&catDict, { xref->getRootNum(), xref->getRootGen() });
}
}
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 613a1e25..0b23f111 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -2220,6 +2220,8 @@ bool PDFDoc::sign(const std::string &saveFilename, const std::string &certNickna
catalog->addFormToAcroForm(ref);
// say that there a now signatures and that we should append only
catalog->getAcroForm()->dictSet("SigFlags", Object(3));
+ catalog->setAcroFormModified();
+
form->ensureFontsForAllCharacters(&signatureText, pdfFontName);
form->ensureFontsForAllCharacters(&signatureTextLeft, pdfFontName);