[poppler] poppler/PDFDoc.cc poppler/PDFDoc.h qt5/src qt6/src utils/pdfsig.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 28 23:16:15 UTC 2022


 poppler/PDFDoc.cc                |    5 +++--
 poppler/PDFDoc.h                 |    4 ++--
 qt5/src/poppler-pdf-converter.cc |    2 +-
 qt6/src/poppler-pdf-converter.cc |    2 +-
 utils/pdfsig.cc                  |    2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 864466a6753014106448f1a6c0000aa68bedf101
Author: Felix Jung <fxjung at posteo.de>
Date:   Fri Jan 28 23:16:13 2022 +0000

    qt: Pass leftFontSize down to `PDFDoc::signsign` so it's actually used

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index dab2add1..ab8e302d 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -2152,8 +2152,8 @@ bool PDFDoc::hasJavascript()
 }
 
 bool PDFDoc::sign(const char *saveFilename, const char *certNickname, const char *password, GooString *partialFieldName, int page, const PDFRectangle &rect, const GooString &signatureText, const GooString &signatureTextLeft,
-                  double fontSize, std::unique_ptr<AnnotColor> &&fontColor, double borderWidth, std::unique_ptr<AnnotColor> &&borderColor, std::unique_ptr<AnnotColor> &&backgroundColor, const GooString *reason, const GooString *location,
-                  const std::string &imagePath, const GooString *ownerPassword, const GooString *userPassword)
+                  double fontSize, double leftFontSize, std::unique_ptr<AnnotColor> &&fontColor, double borderWidth, std::unique_ptr<AnnotColor> &&borderColor, std::unique_ptr<AnnotColor> &&backgroundColor, const GooString *reason,
+                  const GooString *location, const std::string &imagePath, const GooString *ownerPassword, const GooString *userPassword)
 {
     ::Page *destPage = getPage(page);
     if (destPage == nullptr) {
@@ -2190,6 +2190,7 @@ bool PDFDoc::sign(const char *saveFilename, const char *certNickname, const char
     std::unique_ptr<::FormFieldSignature> field = std::make_unique<::FormFieldSignature>(this, Object(annotObj.getDict()), ref, nullptr, nullptr);
     field->setCustomAppearanceContent(signatureText);
     field->setCustomAppearanceLeftContent(signatureTextLeft);
+    field->setCustomAppearanceLeftFontSize(leftFontSize);
     field->setImageResource(imageResourceRef);
 
     Object refObj(ref);
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 0a831dc1..287e53ff 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -336,8 +336,8 @@ public:
     // Argument imagePath is a background image (a path to a file).
     // sign() takes ownership of partialFieldName.
     bool sign(const char *saveFilename, const char *certNickname, const char *password, GooString *partialFieldName, int page, const PDFRectangle &rect, const GooString &signatureText, const GooString &signatureTextLeft, double fontSize,
-              std::unique_ptr<AnnotColor> &&fontColor, double borderWidth, std::unique_ptr<AnnotColor> &&borderColor, std::unique_ptr<AnnotColor> &&backgroundColor, const GooString *reason = nullptr, const GooString *location = nullptr,
-              const std::string &imagePath = "", const GooString *ownerPassword = nullptr, const GooString *userPassword = nullptr);
+              double leftFontSize, std::unique_ptr<AnnotColor> &&fontColor, double borderWidth, std::unique_ptr<AnnotColor> &&borderColor, std::unique_ptr<AnnotColor> &&backgroundColor, const GooString *reason = nullptr,
+              const GooString *location = nullptr, const std::string &imagePath = "", const GooString *ownerPassword = nullptr, const GooString *userPassword = nullptr);
 
 private:
     // insert referenced objects in XRef
diff --git a/qt5/src/poppler-pdf-converter.cc b/qt5/src/poppler-pdf-converter.cc
index e070d51b..71d1c66f 100644
--- a/qt5/src/poppler-pdf-converter.cc
+++ b/qt5/src/poppler-pdf-converter.cc
@@ -138,7 +138,7 @@ bool PDFConverter::sign(const NewSignatureData &data)
     const auto ownerPwd = std::make_unique<GooString>(data.documentOwnerPassword().constData());
     const auto userPwd = std::make_unique<GooString>(data.documentUserPassword().constData());
     return doc->sign(d->outputFileName.toUtf8().constData(), data.certNickname().toUtf8().constData(), data.password().toUtf8().constData(), QStringToGooString(data.fieldPartialName()), data.page() + 1,
-                     boundaryToPdfRectangle(destPage, data.boundingRectangle(), Annotation::FixedRotation), *gSignatureText, *gSignatureLeftText, data.fontSize(), convertQColor(data.fontColor()), data.borderWidth(),
+                     boundaryToPdfRectangle(destPage, data.boundingRectangle(), Annotation::FixedRotation), *gSignatureText, *gSignatureLeftText, data.fontSize(), data.leftFontSize(), convertQColor(data.fontColor()), data.borderWidth(),
                      convertQColor(data.borderColor()), convertQColor(data.backgroundColor()), reason.get(), location.get(), data.imagePath().toStdString(), ownerPwd.get(), userPwd.get());
 }
 
diff --git a/qt6/src/poppler-pdf-converter.cc b/qt6/src/poppler-pdf-converter.cc
index 09b8debf..511fd7ff 100644
--- a/qt6/src/poppler-pdf-converter.cc
+++ b/qt6/src/poppler-pdf-converter.cc
@@ -138,7 +138,7 @@ bool PDFConverter::sign(const NewSignatureData &data)
     const auto ownerPwd = std::make_unique<GooString>(data.documentOwnerPassword().constData());
     const auto userPwd = std::make_unique<GooString>(data.documentUserPassword().constData());
     return doc->sign(d->outputFileName.toUtf8().constData(), data.certNickname().toUtf8().constData(), data.password().toUtf8().constData(), QStringToGooString(data.fieldPartialName()), data.page() + 1,
-                     boundaryToPdfRectangle(destPage, data.boundingRectangle(), Annotation::FixedRotation), *gSignatureText, *gSignatureLeftText, data.fontSize(), convertQColor(data.fontColor()), data.borderWidth(),
+                     boundaryToPdfRectangle(destPage, data.boundingRectangle(), Annotation::FixedRotation), *gSignatureText, *gSignatureLeftText, data.fontSize(), data.leftFontSize(), convertQColor(data.fontColor()), data.borderWidth(),
                      convertQColor(data.borderColor()), convertQColor(data.backgroundColor()), reason.get(), location.get(), data.imagePath().toStdString(), ownerPwd.get(), userPwd.get());
 }
 
diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc
index fbba2505..a1d70e88 100644
--- a/utils/pdfsig.cc
+++ b/utils/pdfsig.cc
@@ -343,7 +343,7 @@ int main(int argc, char *argv[])
 
         // We don't provide a way to customize the UI from pdfsig for now
         const bool success = doc->sign(argv[2], certNickname, pw, newSignatureFieldName.copy(), /*page*/ 1,
-                                       /*rect */ { 0, 0, 0, 0 }, /*signatureText*/ {}, /*signatureTextLeft*/ {}, /*fontSize */ 0,
+                                       /*rect */ { 0, 0, 0, 0 }, /*signatureText*/ {}, /*signatureTextLeft*/ {}, /*fontSize */ 0, /*leftFontSize*/ 0,
                                        /*fontColor*/ {}, /*borderWidth*/ 0, /*borderColor*/ {}, /*backgroundColor*/ {}, rs.get(), /* location */ nullptr, /* image path */ "", ownerPW.get(), userPW.get());
         return success ? 0 : 3;
     }


More information about the poppler mailing list