ENH: add sign command#165
Conversation
d5ca716 to
b6ce05e
Compare
Lucas-C
left a comment
There was a problem hiding this comment.
Thank you very much @moormaster for working on this feature 👍
I made a few comments as feedback
e9ac7e2 to
774ebd4
Compare
|
Could you also please add a mention of this new feature in I'll answer your comments in a few hours, can't do it right now, but thank you for all your work on this 👍 |
774ebd4 to
0f65948
Compare
Added an entry to CHANGELOG.md and fixed commit message & PR title: |
|
I think this is ready to merged, as soon as the CI pipeline is ✅ 🙂 Good job really on this PR 👍 Also, have you tested signing a PDF and then sign it again with |
|
@allcontributors please add @moormaster for code |
|
I've put up a pull request to add @moormaster! 🎉 |
I guess this would currently generate a broken pdf - When fully generating a pdf with fdpf2 the fpdf.sign() method prevents itself from being called multiple times on the same document. The sign command of pdfly should check for an existing signature annotation and refuse to add another signature in this case + another unit test to test this behaviour. |
c61d887 to
e530e86
Compare
982470c to
574b931
Compare
|
I guess I might have fixed all the PR related CI failures. I did not focus on the python 3.8 pipeline since that python version already reached its end-of-life. Added a unit test to ensure that attempts to sign an already signed pdf will be denied. |
9b60757 to
7ef3758
Compare
Great 👍 |
7ef3758 to
a3f2a42
Compare
Create a signed pdf from an existing one. Issue: #71
…ontextmanager usage
a3f2a42 to
89918d3
Compare
|
I'm rebasing the branch so that you benefit from the removal of Python3.8 & Python3.9 in the pipeline test matrix. There's now just this single |
Fixed |
|
This new command has been included in the latest 0.5.0 release: https://github.com/py-pdf/pdfly/releases/tag/0.5.0 |
.p12keyThe annotation for the signature needs to calculate its hash value from the contents and the certificate. When using fpdf2 no contents are present in the newly created FPDF instance. To sign the contents from an existing pdf some magic must be done:
->
_sign_key = Noneis set before serializing the FPDF instance.-> For
sign_content()to succeed the placeholders must be search&replaced back into their original form howsign_content()expects them to look like