Some test text!

menu
search
Certify a documentkeyboard_arrow_down

Certify a PDF document

To add a certification signature field to a PDF document and sign it:

// Open an existing PDF
using (PDFDoc doc = new PDFDoc(docpath))
{
    Page page1 = doc.GetPage(1);

    // Create a text field that we can lock using the field permissions feature.
    TextWidget annot1 = TextWidget.Create(doc, new Rect(50, 550, 350, 600), "asdf_test_field");
    page1.AnnotPushBack(annot1);

    /* Create a new signature form field in the PDFDoc. The name argument is optional;
    leaving it empty causes it to be auto-generated. However, you may need the name for later.
    Acrobat doesn't show digsigfield in side panel if it's without a widget. Using a
    Rect with 0 width and 0 height, or setting the NoPrint/Invisible flags makes it invisible. */
    DigitalSignatureField certification_sig_field = doc.CreateDigitalSignatureField(cert_field_name);
    SignatureWidget widgetAnnot = SignatureWidget.Create(doc, new Rect(0, 100, 200, 150), certification_sig_field);
    page1.AnnotPushBack(widgetAnnot);

    // (OPTIONAL) Add an appearance to the signature field.
    Image img = Image.Create(doc, appearance_image_path);
    widgetAnnot.CreateSignatureAppearance(img);

    // Prepare the document locking permission level. It will be applied upon document certification.
    certification_sig_field.SetDocumentPermissions(DigitalSignatureField.DocumentPermissions.e_annotating_formfilling_signing_allowed);
    
    // Prepare to lock the text field that we created earlier.
    string[] fields_to_lock = new string[1];
    fields_to_lock[0] = "asdf_test_field";
    certification_sig_field.SetFieldPermissions(DigitalSignatureField.FieldPermissions.e_include, fields_to_lock);

    certification_sig_field.CertifyOnNextSave(private_key_file_path, keyfile_password);

    // (OPTIONAL) Add more information to the signature dictionary.
    certification_sig_field.SetLocation("Vancouver, BC");
    certification_sig_field.SetReason("Document certification.");
    certification_sig_field.SetContactInfo("www.pdftron.com");

    // Save the PDFDoc. Once the method below is called, PDFNet will also sign the document using the information provided.
    doc.Save(outpath, 0);
}

Digitally sign PDF files
Full code sample which demonstrates using the digital signature API to digitally sign and/or certify PDF documents.

linkAbout certifying a PDF document

Unlike, approval signatures, there can be only one certification per PDF document. Only the first signature in the PDF document can be used as the certification signature. Certifying a document is like notarizing a document. The process of certifying a document is almost exactly the same as adding approval signatures with the exception of certification signatures requires an entry in the "Perms" dictionary.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn More
close