digitorus / pdfsign

Add/verify Advanced Electronic Signature (AES) and Qualified Electronic Signature (QES) in PDF (usign pure Go)
BSD 2-Clause "Simplified" License
72 stars 16 forks source link

Visual signature support #20

Open zosocanuck opened 10 months ago

zosocanuck commented 10 months ago

I am testing this library/utility and noticed support for visual signatures, however when attempting to sign a sample PDF, the visual signature doesn't appear at least in the latest version of Adobe. Has this been tested?

vanbroup commented 10 months ago

There is a test case for visual signatures:

sign/pdfvisualsignature_test.go

I don't have tested myself this recently. Can you do a test based on the unit test (including) the file?

karelbilek commented 10 months ago

It doesn't show because the Rect is 0 0 0 0.

However even if I change the Rect I see nothing, I think because there is no reference to any other visual object...?

(when I change the rect, Acrobat says it's "visible signature" but then shows nothing)

karelbilek commented 10 months ago

Ahhh that's because it's AcroForm stuff, so I would also need to set appearance and /AP object... ugh no. AcroForms = hell. :D

vanbroup commented 10 months ago

If you have a working example it would be great to add this to the documentation!

karelbilek commented 10 months ago

I don't think it can be done just with this library; if I look at other PDFs with visual signatures (made by Acrobat I think), it has AP appearence streams, and I am not sure this library can do it.

Maybe if it is somehow used with conjunction with pdfcpu https://github.com/pdfcpu/pdfcpu ... but that gets me thinking it would be maybe better to add the signing functionality into pdfcpu