Skip to main content

IExternalSigner Interface

Exposes the basic functionality to generate signatures.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Core.dll

NuGet Package: DevExpress.Pdf.Core


public interface IExternalSigner


The Pkcs7Signer and PdfTimeStamp classes are default IExternalSigner implementations. Use these classes to generate signatures or create an implementation.

Pass the IExternalSigner implementation object to the PdfSignatureBuilder instance constructor to apply the signature to the signature field, as shown below:

using (var signer = new PdfDocumentSigner("Document.pdf"))
    //Create a timestamp:
    ITsaClient tsaClient = new PdfTsaClient(new Uri(@""), HashAlgorithmType.SHA256);

    //Create a PKCS#7 PAdES signature:
    Pkcs7Signer pkcs7Signature = new Pkcs7Signer("Signing Documents/certificate.pfx", "123", HashAlgorithmType.SHA256, tsaClient, null, null, PdfSignatureProfile.PAdES_BES);

    //Apply the signature to an existing form field:
    var santuzzaSignature = new PdfSignatureBuilder(pkcs7Signature, "Sign");

    //Specify an image and signer information:
    santuzzaSignature.SetImageData(System.IO.File.ReadAllBytes("Signing Documents/SantuzzaValentina.jpg"));
    santuzzaSignature.Location = "Australia";
    santuzzaSignature.Name = "Santuzza Valentina";
    santuzzaSignature.Reason = "I Agree";
    santuzzaSignature.CertificationLevel = PdfCertificationLevel.FillFormsAndAnnotate;

    //Create a new signature form field:
    var signatureFieldInfo1 = new PdfSignatureFieldInfo(1);
    signatureFieldInfo1.Name = "SignatureField1";
    signatureFieldInfo1.SignatureBounds = new PdfRectangle(200, 200, 250, 250);

    //Create a document-level timestamp:
    PdfTimeStamp pdfTimeStamp = new PdfTimeStamp(tsaClient);

    //Apply this timestamp to the form field:
    var timeStampSignature = new PdfSignatureBuilder(pdfTimeStamp, signatureFieldInfo1);

    //Add signatures to an array:
    PdfSignatureBuilder[] signatures = { santuzzaSignature, timeStampSignature };

    //Sign and save the document:
    signer.SaveDocument("SignedDocument.pdf", signatures);
See Also