What are the different types of digital signatures that can be added to a PDF using PDFNet?

263 views
Skip to first unread message

Ryan

unread,
Jan 15, 2016, 4:38:48 PM1/15/16
to pdfne...@googlegroups.com
Answer:
There are two types of digital signatures in a PDF.

Author Signature : Zero or One
Approval/Recipient Signatures : Zero to Many

Our DigitalSignature sample shows the two types of signatures.
https://www.pdftron.com/pdfnet/samplecode.html#Sig

static bool CertifyPDF() // shows adding Author signature (can only call once on a document)
static bool SignPDF()    // shows adding an Approval signature (you can have as many of these as you want)

In particular, the Author Signature is indicated by the DocMDP entry. You can only have one of these, and it must be the first signature.

The Approval signatures are always associated with Field/Widget. While Author signatures should also be associated with a Widget (though not a field) on the any page (1st is probably the best). This way the signature will appear in the Adobe Acrobat UI. The Rect of the Widgets (for both Approval and Author signatures) can be zero area if you don't want to show anything graphical. Adobe Acrobat will only enumerate and display signatures in the user interface that are part of Widget annotation.

So, in short, you can have multiple signatures, but only one can be DocMDP/Author signature. The rest must be Approval signatures (which should be associated with a Signature Field. Note, the DocMDP one should also be associated with a Field and Widget, but the widget should have a zero rect.)

Note that the actual digital signature calculation occurs at the time of saving.

Furthermore, to add additional signatures you need to save incrementally, so as not to modify the original data and therefore accidentally invalidate the previous signature(s).

So after opening a file, but before adding your own signature, you can check for a digital signature.
PDFDoc doc = new PDFDoc(path);
doc
.InitSecurityHandler();
bool has_sigs_and_needs_incremental_save = doc.HasSignatures();

Finally, if you want to do multiple signatures in a row, you need to re-open the file after each save. See this post for more.
https://groups.google.com/d/msg/pdfnet-sdk/BxT_8c2dA1o/kXG375XlZDwJ

Reply all
Reply to author
Forward
0 new messages