[poppler] 4 commits - poppler/Annot.cc poppler/Form.cc poppler/PDFDoc.cc poppler/SignatureHandler.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 30 01:40:19 UTC 2022
poppler/Annot.cc | 2 +-
poppler/Form.cc | 2 +-
poppler/PDFDoc.cc | 14 ++++++--------
poppler/SignatureHandler.cc | 6 +++++-
4 files changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 5c3cbea4044fed263fe5e34d911e9db85d55bdf4
Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date: Thu Aug 4 10:31:16 2022 -0600
SignatureHandler: Fix getSignerName when signing_cert is available but CMSSignerInfo is not
diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc
index 3d5494c2..729c2b15 100644
--- a/poppler/SignatureHandler.cc
+++ b/poppler/SignatureHandler.cc
@@ -525,7 +525,11 @@ std::string SignatureHandler::getSignerName()
{
char *commonName;
- if (!CMSSignerInfo || !NSS_IsInitialized()) {
+ if (!NSS_IsInitialized()) {
+ return {};
+ }
+
+ if (!signing_cert && !CMSSignerInfo) {
return {};
}
commit 8452b0dee6b5267e785bf6dea4d7b537a4cfb637
Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date: Sat Jul 30 15:40:08 2022 -0600
Form: When signing with an appearance, ensure that a Form exists
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 3657c03e..4dfba6dd 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -696,7 +696,7 @@ bool FormWidgetSignature::signDocumentWithAppearance(const char *saveFilename, c
GooString *aux = getField()->getDefaultAppearance();
std::string originalDefaultAppearance = aux ? aux->toStr() : std::string();
- Form *form = doc->getCatalog()->getForm();
+ Form *form = doc->getCatalog()->getCreateForm();
std::string pdfFontName = form->findFontInDefaultResources("Helvetica", "");
if (pdfFontName.empty()) {
pdfFontName = form->addFontToDefaultResources("Helvetica", "").fontName;
commit 2beb458226509c3babd78e658e1a8ac72ccfb2b8
Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date: Sat Jul 30 10:27:23 2022 -0600
Annot: Fix applying signatures to fields that are not part of a form
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index c617461a..04b82ba0 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -5261,7 +5261,7 @@ void AnnotAppearanceBuilder::drawSignatureFieldText(const GooString &text, const
const double textwidth = width - 2 * textmargin;
// create a Helvetica fake font
- std::shared_ptr<const GfxFont> font = form->getDefaultResources()->lookupFont(da.getFontName().getName());
+ std::shared_ptr<const GfxFont> font = form ? form->getDefaultResources()->lookupFont(da.getFontName().getName()) : nullptr;
if (!font) {
font = createAnnotDrawFont(xref, resourcesDict, da.getFontName().getName());
}
commit 977dd2171fc3cf91d4a9d5855e379c39df8ee77e
Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date: Fri Jul 29 17:04:36 2022 -0600
PDFDoc: Fix finding signature fields not associated with a form
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index faab87ac..05cc04a5 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -565,14 +565,12 @@ std::vector<FormFieldSignature *> PDFDoc::getSignatureFields()
// First search
const Form *f = catalog->getForm();
- if (!f) {
- return res;
- }
-
- const int nRootFields = f->getNumFields();
- for (int i = 0; i < nRootFields; ++i) {
- FormField *ff = f->getRootField(i);
- addSignatureFieldsToVector(ff, res);
+ if (f) {
+ const int nRootFields = f->getNumFields();
+ for (int i = 0; i < nRootFields; ++i) {
+ FormField *ff = f->getRootField(i);
+ addSignatureFieldsToVector(ff, res);
+ }
}
// Second search
More information about the poppler
mailing list