vbuch / node-signpdf

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

I need put text or image in my signature without change the file structure. If I change, all my oldest signatures will be invalid. It's possible?? #199

Closed taotaow2n closed 7 months ago

taotaow2n commented 8 months ago

Describe the bug and the expected behaviour I need put text or image in my signature without change the file structure. If I change, all my oldest signatures will be invalid. It's possible??,thank you very much

vbuch commented 8 months ago

The most important thing a signature states is that the content was not altered since the application of the signature. If you alter any bit of the file the signature will be invalid and editors will say something like "File was modified after it was signed".

taotaow2n commented 8 months ago

hi,https://github.com/RippleRurigaki/sPDF.js ,this project can do it ,Support for incremental updates,Add a new signature without modifying the PDF document. Existing content, including signatures, will be maintained. Can it be integrated into 'node-signpdf'? I think it's cool @vbuch

vbuch commented 8 months ago

@taotaow2n incremental updates will allow you to add content on top of the previous revisions of the file, yes. But that is still a change AFTER the signature so the viewer should warn you that the file was altered after it was signed. You can then sign it additionally (again with incremental updates). The new signature will be valid, the previous one will still say "altered after me".

Maybe see https://github.com/vbuch/node-signpdf/blob/develop/packages/signpdf/src/signpdf.test.js#L211

taotaow2n commented 8 months ago

@vbuch Thank you for your reply. I tried what you said and it worked. But how can I put text or image in my signature? Looking forward to your reply, thank you

vbuch commented 8 months ago

@taotaow2n if I have some time today and will try to prepare an example of the above.

vbuch commented 8 months ago

@taotaow2n I couldn't finish it. Hope I'll find the time for that today. But here is the general idea: https://github.com/vbuch/node-signpdf/compare/develop...feature/with-visible-widget#diff-a728ac89daf3c377e68e4e25a1ab6cc17f921cfcba4499cad818c546c1975da2R79 Note that this requires a change in the placeholder helprs so that they can accept the widgetRect prop.

vbuch commented 8 months ago

PR: https://github.com/vbuch/node-signpdf/pull/200

vbuch commented 7 months ago

https://github.com/vbuch/node-signpdf/releases/tag/v3.1.0