[poppler] qt5/src qt6/src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 12 00:21:17 UTC 2022


 qt5/src/poppler-pdf-converter.cc |   14 +++++++++++++-
 qt5/src/poppler-qt5.h            |   11 +++++++++++
 qt6/src/poppler-pdf-converter.cc |   14 +++++++++++++-
 qt6/src/poppler-qt6.h            |   11 +++++++++++
 4 files changed, 48 insertions(+), 2 deletions(-)

New commits:
commit 327cd87e489fd2be39bdb5bad394ce33be247dde
Author: Martin <martinbts at gmx.net>
Date:   Wed Jan 12 00:21:13 2022 +0000

    [qt] Add PDFConverter::NewSignatureData::imagePath

diff --git a/qt5/src/poppler-pdf-converter.cc b/qt5/src/poppler-pdf-converter.cc
index 1a21c591..bd3d8006 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 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(),
-                     convertQColor(data.borderColor()), convertQColor(data.backgroundColor()), reason.get(), location.get(), "" /*imagepath*/, ownerPwd.get(), userPwd.get());
+                     convertQColor(data.borderColor()), convertQColor(data.backgroundColor()), reason.get(), location.get(), data.imagePath().toStdString(), ownerPwd.get(), userPwd.get());
 }
 
 struct PDFConverter::NewSignatureData::NewSignatureDataPrivate
@@ -164,6 +164,8 @@ struct PDFConverter::NewSignatureData::NewSignatureDataPrivate
 
     QByteArray documentOwnerPassword;
     QByteArray documentUserPassword;
+
+    QString imagePath;
 };
 
 PDFConverter::NewSignatureData::NewSignatureData() : d(new NewSignatureDataPrivate()) { }
@@ -342,4 +344,14 @@ void PDFConverter::NewSignatureData::setDocumentUserPassword(const QByteArray &p
 {
     d->documentUserPassword = password;
 }
+
+QString PDFConverter::NewSignatureData::imagePath() const
+{
+    return d->imagePath;
+}
+
+void PDFConverter::NewSignatureData::setImagePath(const QString &path)
+{
+    d->imagePath = path;
+}
 }
diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h
index 8fa0a51e..4b1af1e5 100644
--- a/qt5/src/poppler-qt5.h
+++ b/qt5/src/poppler-qt5.h
@@ -2311,6 +2311,17 @@ public:
         QByteArray documentUserPassword() const;
         void setDocumentUserPassword(const QByteArray &password);
 
+        /**
+         * Filesystem path to an image file to be used as background
+         * image for the signature annotation widget.
+         *
+         * Default: empty
+         *
+         * \since 22.02
+         */
+        QString imagePath() const;
+        void setImagePath(const QString &path);
+
     private:
         struct NewSignatureDataPrivate;
         NewSignatureDataPrivate *const d;
diff --git a/qt6/src/poppler-pdf-converter.cc b/qt6/src/poppler-pdf-converter.cc
index 687d0e52..5a75f1e8 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 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(),
-                     convertQColor(data.borderColor()), convertQColor(data.backgroundColor()), reason.get(), location.get(), "" /*imagepath*/, ownerPwd.get(), userPwd.get());
+                     convertQColor(data.borderColor()), convertQColor(data.backgroundColor()), reason.get(), location.get(), data.imagePath().toStdString(), ownerPwd.get(), userPwd.get());
 }
 
 struct PDFConverter::NewSignatureData::NewSignatureDataPrivate
@@ -164,6 +164,8 @@ struct PDFConverter::NewSignatureData::NewSignatureDataPrivate
 
     QByteArray documentOwnerPassword;
     QByteArray documentUserPassword;
+
+    QString imagePath;
 };
 
 PDFConverter::NewSignatureData::NewSignatureData() : d(new NewSignatureDataPrivate()) { }
@@ -342,4 +344,14 @@ void PDFConverter::NewSignatureData::setDocumentUserPassword(const QByteArray &p
 {
     d->documentUserPassword = password;
 }
+
+QString PDFConverter::NewSignatureData::imagePath() const
+{
+    return d->imagePath;
+}
+
+void PDFConverter::NewSignatureData::setImagePath(const QString &path)
+{
+    d->imagePath = path;
+}
 }
diff --git a/qt6/src/poppler-qt6.h b/qt6/src/poppler-qt6.h
index 1c8948e9..f4ec26a0 100644
--- a/qt6/src/poppler-qt6.h
+++ b/qt6/src/poppler-qt6.h
@@ -2087,6 +2087,17 @@ public:
         QByteArray documentUserPassword() const;
         void setDocumentUserPassword(const QByteArray &password);
 
+        /**
+         * Filesystem path to an image file to be used as background
+         * image for the signature annotation widget.
+         *
+         * Default: empty
+         *
+         * \since 22.02
+         */
+        QString imagePath() const;
+        void setImagePath(const QString &path);
+
     private:
         struct NewSignatureDataPrivate;
         NewSignatureDataPrivate *const d;


More information about the poppler mailing list