vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
711 stars 178 forks source link

Add a signature box to the signed pdf #226

Open Chunkygoo opened 7 months ago

Chunkygoo commented 7 months ago

Is there a way to add a "signature box" to the signed pdf where if clicked on, shows the information of the certificate? This brings up a signature box that's similar to Adobe reader's signature panel.

Example: image

Link:

https://ironpdf.com/blog/compare-to-other-components/add-digital-signature-topdf-in-csharp-using-itextsharp/

vbuch commented 7 months ago

Hi, 1: If the signature is valid or not is not supposed to be rendered in the document. That is for the reader (Adober Reader or other) to verify and tell you. 2: Adding a box is something standard. Here is an example of how that's done with PDFKit. Also have a look at the issues tagged "visual".

Chunkygoo commented 7 months ago

Hi,

1: If the signature is valid or not is not supposed to be rendered in the document. That is for the reader (Adober Reader or other) to verify and tell you.

2: Adding a box is something standard. Here is an example of how that's done with PDFKit. Also have a look at the issues tagged "visual".

Thanks for the reply. I agree with you on 1, but the link I attached seems to be able to link the box to Adobe reader's "signature panel". Any idea how that's done?

vbuch commented 7 months ago

The widget (one that is not [0, 0, 0, 0]) as shown in the linked example will appear in the document active element (hoverable) in my Adobe Reader. image

Clicking it will open up the Signature Validation Status dialog for this signature. image

Chunkygoo commented 7 months ago

which widget exactly? is it the addVisual function you're talking about? https://github.com/vbuch/node-signpdf/blob/develop/packages/examples/src/pdfkit010-with-visual.js#L82

Also, do you mind showing the full dialog of the 'Signature Validation Status' image please just so I can make sure it is indeed what Im looking for?

vbuch commented 7 months ago

No. I'm not talking about addVisual. That just draws something. I used the word "widget" intentionally. I don't think it can be more readable really: https://github.com/vbuch/node-signpdf/blob/develop/packages/examples/src/pdfkit010-with-visual.js#L96

README here then node src/pdfkit010-with-visual.js. Output will be in the output dir. Then you can make sure it is what you are looking for.

troyam commented 7 months ago

What version of node are you using?

lutfi-haslab commented 7 months ago

How to add image or annotation with pdf-lib? As far as i know, pdfkit only for creation, cause i dont find load function like in pdf-lib.

vbuch commented 7 months ago

@troyam

% node --version
v21.1.0

@lutfi-haslab pdf-lib allows you to load. It also allows you to add whatever you want to the document. The only thing missing is incremental updates so multiple signatures are not possible with it. If you are asking about pdfkit, I'm sorry but I don't know a way to do it with pdfkit. That is actually why the plain placeholder helper exists.