ComponentOne PDF for .NET
In This Topic
    Signature
    In This Topic

    A digital signature in PDF refers to a secure electronic signature that is generated using a digital certificate. PDF for .NET enables you to digitally sign a Pdf document to secure the authenticity of the content. A digitally signed document assures that it has been created by the signer and has not been changed in any way.

    PDF for .NET allows you to add a digital signature field in a PDF document using PdfSignature class. Using this signature field, you can add a signature in your Pdf document. You can also add text, contact information or image to the signature. Therefore, when you save a document, the content and the signature are included in the PDF.

    The following image showcases a PDF document with a digital signature field ready to be signed.

    To enable a user to add a digital signature in a Pdf document, use the following code.

    C#
    Copy Code
    //Add text
    pdf.DrawString("Please Sign here", font, Brushes.Black, rect);
    PdfSignature sign = new PdfSignature();
    sign.Visibility = FieldVisibility.Visible;
    sign.DefaultText = "Signature";
    sign.ToolTip = "Digital Signature";
    sign.BorderColor = Color.Black;
    
    pdf.AddField(sign, 0, new RectangleF(20, 20, 200, 50));
                
    pdf.Save("SignatureHandler.pdf");
    ProcessStartInfo psInfo = new ProcessStartInfo
    {
        FileName = "SignatureHandler.pdf",
        UseShellExecute = true
    };
    Process.Start(psInfo);