Use new poppler "fancy signature"

remotes/origin/work/spdx
Albert Astals Cid 5 years ago committed by Albert Astals Cid
parent 3ff6ff35ba
commit 1c349f5448
  1. 10
      generators/poppler/CMakeLists.txt
  2. 3
      generators/poppler/config-okular-poppler.h.cmake
  3. 7
      generators/poppler/generator_pdf.cpp

@ -25,6 +25,16 @@ int main()
}
" HAVE_POPPLER_SIGNING)
check_cxx_source_compiles("
#include <poppler-qt5.h>
#include <poppler-form.h>
int main()
{
Poppler::PDFConverter::NewSignatureData pData;
pData.setSignatureLeftText(QString());
}
" HAVE_POPPLER_FANCY_SIGNATURE)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h

@ -3,3 +3,6 @@
/* Defined if we have the pdf signature feature in the Poppler library */
#cmakedefine HAVE_POPPLER_SIGNING 1
/* Defined if we have the pdf fancy signature feature in the Poppler library */
#cmakedefine HAVE_POPPLER_FANCY_SIGNATURE 1

@ -1894,10 +1894,11 @@ bool PDFGenerator::sign(const Okular::NewSignatureData &oData, const QString &rF
pData.setCertNickname(oData.certNickname());
pData.setPassword(oData.password());
pData.setPage(oData.page());
const QDateTime t = QDateTime::currentDateTime();
// This way we force the timezone info to be included in the string
const QString datetime = t.toTimeZone(t.timeZone()).toString(Qt::ISODate);
const QString datetime = QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss t"));
pData.setSignatureText(i18n("Signed by: %1\n\nDate: %2", oData.certSubjectCommonName(), datetime));
#if HAVE_POPPLER_FANCY_SIGNATURE
pData.setSignatureLeftText(oData.certSubjectCommonName());
#endif
const Okular::NormalizedRect bRect = oData.boundingRectangle();
pData.setBoundingRectangle({bRect.left, bRect.top, bRect.width(), bRect.height()});
pData.setFontColor(Qt::black);

Loading…
Cancel
Save