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

There are three types of digital signatures in a PDF.

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

Our DigitalSignature sample shows the three types of signatures.

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)
static bool TimestampAndEnableLTV() // shows adding a Document timestamp (can also 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. Furthermore these are often not displayed on any one page.

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, though it is good practice to only have Author Signatures not shown on a page. Adobe Acrobat will only enumerate and display signatures in the user interface that are part of Widget annotation.

Finally, the Document Timestamp signatures allow you snapshot the exact binary of a PDF at particular date and time.

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);
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.

1 Like