Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfDocumentSigner(Stream) Constructor

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

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.2.dll

NuGet Package: DevExpress.Document.Processor

#Declaration

public PdfDocumentSigner(
    Stream stream
)

#Parameters

Name Type Description
stream Stream

The stream that contains a document that needs to be signed.

#Remarks

using DevExpress.Pdf;
using DevExpress.Office.DigitalSignatures;

/ /Load a document to be signed
using (var signer = new PdfDocumentSigner("SignedDocument.pdf"))
{
    // Specify the name and location of the signature field
    var description = new PdfSignatureFieldInfo(1);
    description.Name = "SignatureField";
    description.SignatureBounds = new PdfRectangle(10, 10, 150, 150);

    // Create a PKCS#7 signature
    Pkcs7Signer signature = new Pkcs7Signer("Signing Documents//testcert.pfx", "123", HashAlgorithmType.SHA256);

    // Apply a signature to a new form field
    var signatureBuilder = new PdfSignatureBuilder(signature, description);

    // Specify the signature's image and signer information
    signatureBuilder.SetImageData(System.IO.File.ReadAllBytes("Signing Documents//Signature.jpg"));
    signatureBuilder.Location = "USA";
    signatureBuilder.Name = "Jane Cooper";

    // Sign and save the document
    signer.SaveDocument("out2.pdf", signatureBuilder);
}
See Also