Skip to main content
All docs
V25.1
  • PdfSignatureBuilder(IExternalSigner, String) Constructor

    Initializes a new instance of the PdfSignatureBuilder class with specified settings.

    Namespace: DevExpress.Pdf

    Assembly: DevExpress.Pdf.v25.1.Core.dll

    NuGet Package: DevExpress.Pdf.Core

    Declaration

    public PdfSignatureBuilder(
        IExternalSigner signer,
        string formFieldName
    )

    Parameters

    Name Type Description
    signer IExternalSigner

    An object used to generate a signature.

    formFieldName String

    The name of the signature form field to sign.

    Exceptions

    Type Description
    TspValidationException

    Occurs if the field with the specified name does not exist.

    Remarks

    Use this class constructor to sign an existing form field.

    Use the Pkcs7Signer class to generate the PKCS#7 signature. Create the Pkcs7SignerBase class descendant to use a custom object to generate the PKCS#7 signature.

    //Load a document to be signed:
    using (var signer = new PdfDocumentSigner("Document.pdf"))
    {
        //Create a PKCS#7 signature:
        Pkcs7Signer pkcs7Signature = new Pkcs7Signer("Signing Documents//testcert.pfx", "123", HashAlgorithmType.SHA256);
    
        //Apply a signature to the 'Sign' form field:
        var signatureBuilder = new PdfSignatureBuilder(pkcs7Signature, "Sign");
    
        //Specify the signature's image and signer information:
        signatureBuilder.SetImageData(System.IO.File.ReadAllBytes("Signing Documents//Jane Cooper.jpg"));
        signatureBuilder.Location = "USA";
        signatureBuilder.Name = "Jane Cooper";
        signatureBuilder.Reason = "I Agree";
    
        //Sign and save the document:
        signer.SaveDocument("SignedDocument.pdf", signatureBuilder);
    }
    
    See Also