Support using PDF, in addition to images, as the signature graphic#1181
Support using PDF, in addition to images, as the signature graphic#1181Alkaid-Benetnash wants to merge 1 commit intoLibrePDF:masterfrom
Conversation
|
|
For end-to-end testing with jsignpdf, please refer to this PR intoolswetrust/jsignpdf#185 |
asturio
left a comment
There was a problem hiding this comment.
Hi there,
at first sorry for the late reaction. Too much work at work.
In the original code there were to Blocks which differ a little bit, by the calculation of y. So the semantic is changed if both blocks are calling the same method now: renderSignatureGraphics().
There is this 15there. So probably something will break here.
Could you please take a look at that.
OpenPDF has a very bad test coverage, and caution must be taken.
New test for existing code (code you change) are very welcome.
| // experimentation found this magic number to counteract Adobe's | ||
| // signature graphic, which | ||
| // offsets the y co-ordinate by 15 units | ||
| float y = -im.getScaledHeight() + 15; |
There was a problem hiding this comment.
Here is some kind of weird initialization.
|
|
||
| ct2.go(); | ||
| } else if (render == SignatureRenderGraphicAndDescription) { | ||
| ColumnText ct2 = new ColumnText(t); |
| ct2.go(); | ||
| renderSignatureGraphic(t, signatureRect); | ||
| } else if (this.render == SignatureRenderGraphic) { | ||
| ColumnText ct2 = new ColumnText(t); |
| * @param t the new PDF object/layer to render on | ||
| */ | ||
| private void renderSignatureGraphic(PdfTemplate t, Rectangle signatureRect) { | ||
| if (this.signatureGraphic != null) { |
|




Description of the new Feature
Support using PDF (vector graphics), in addition to images (i.e., png, jpg) as the visible signature.
I implemented this feature by adding a new function
setSignaturePDF. Then I copy a configurable page from the given PDF as the signature and render it to the proper place.Related Issue: #777
Unit-Tests for the new Feature/Bugfix
Compatibilities Issues
Only added new methods. No existing method signature or functionality changes. Should have no compatibility issues.
Your real name
No conflict of interest.
I am a jsignpdf user, who wants to embed vector signatures into pdf, just like the other user in #777.
Prefer to not provide real name unless maintainer insists.
Testing details
Updated the PdfSignatureAppearance test to use both an image signature (old feature, never tested) and a PDF signature (new feature).
I also changed the jsignpdf application to make use of this new feature. Will update a reference here once the jsignpdf PR is created.