Unify signature appearance options
I am working on some enhancements to the pdfsig utility to allow customisation of the appearance of the signature. In doing so, I found some inconsistency between the parameters to FormWidgetSignature::signDocumentWithAppearance
(sign an existing signature field) and PDFDoc::sign
(add and sign a new field). This merge request has two commits which make the following changes to make these methods consistent with respect to the appearance options:
-
Add an
imagePath
parameter toFormWidgetSignature::signDocumentWithAppearance
. This takes a path to an image file which is embedded and used as the background to the signature. It behaves in the same way as the existingimagePath
parameter toPDFDoc::sign
. Note that the qt5 and qt6 bindings are updated to pass the value of theimagePath
field of theirPDFConverter::NewSignatureData
structure to this method. This field has been in the bindings since 22.02 (added in commit 327cd87e) and is currently used inqt{5,6}/src/poppler-pdf-converter.cc
when calling thePDFDoc::sign
method. I therefore assumed it would be correct to use the field in the same way whensignDocumentWithAppearance
is called, but this is easily reverted if it is not appropriate. -
In
PDFDoc::sign
, calculate an optimal font size if the given font size is zero. This uses the same logic as already exists inFormWidgetSignature::signDocumentWithAppearance
.