Skip to content

Unify signature appearance options

Blair Bonnett requested to merge bcb/poppler:unify-signing-options into master

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 to FormWidgetSignature::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 existing imagePath parameter to PDFDoc::sign. Note that the qt5 and qt6 bindings are updated to pass the value of the imagePath field of their PDFConverter::NewSignatureData structure to this method. This field has been in the bindings since 22.02 (added in commit 327cd87e) and is currently used in qt{5,6}/src/poppler-pdf-converter.cc when calling the PDFDoc::sign method. I therefore assumed it would be correct to use the field in the same way when signDocumentWithAppearance 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 in FormWidgetSignature::signDocumentWithAppearance.

Merge request reports

Loading