vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
679 stars 176 forks source link

add signer and sign in a signed pdf #171

Closed aallvi closed 11 months ago

aallvi commented 1 year ago

Hi vbuch and devs, i have a problem doing this, i sign a pdf with node sign without problems, i add placeholder, the signature and all.

The problem is that i need to add another signature to the pdf and i create another placeholder and when i try to sign, the new signature erase de old signature, so in the adobe acrobat i can see only the new signature.

i know that this is posible with this library, in the resources folder i see a pdf with 2 signatures.

you can see the code here https://github.com/aallvi/signature/blob/main/src/SignPDF.js , is the code of some guy thats make a video of this. i make some changes for my project.

when i took a signed pdf and i try to sign again, the new signature delete the old.

any help or guidance is appreciated.

Thanks.

aallvi commented 1 year ago

with this code https://github.com/aallvi/signature/blob/main/src/prueba.js

i can sign twice a pdf, but in the second signature, i cant put the qrcode and the text because obviusly the pdf is diferent when the have the first signature, so is invalid.

anybody have some idea how to d this, sign in second time with the p12 and a image in the pdf, without the adobe acrobat say that is invalid?

vbuch commented 1 year ago

Hi there. The first important part to understand is incremental updates of PDFs. If you are altering a signed PDF that doesn't make make the previous signature invalid directly. It was valid to the revision before you altered it. Once you understand incremental updates you will know how multiple signatures in PDF work. There is no such thing as "two parties signed the document simultaneously". The two parties rather pass the document on the table so one is signing a "blank" document and the second is signing an already signed document. I would suggest you try with some simplier scenarios (with simplified PDFs as well) before shooting at the real world ones.

aallvi commented 1 year ago

Hi, thanks for your answer. I understand that you say, so can i make incremental updates with this library? in the description in npm says: 'does not cover multiple signatures, incremental updates, etc. Only the basic scenario of signing a freshly created PDF'

but in resources are an incremental pdf signed, can you give me some guidance? some example of how to can 'tell' to the pdf thats the new modification (like a image or a qr) in pdf is a signature and not a modification in the content?

if i cant do that with node-sign i like to know that, because i need to think how i continue with my project.

Thanks!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions.