Skip to main content
.NET Framework 4.5.2+

PdfDocumentSigner.SaveDocument(String, PdfSignatureBuilder[]) Method

Saves the PDF document to a file with the specified document signatures.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v22.2.dll

Declaration

public void SaveDocument(
    string filePath,
    params PdfSignatureBuilder[] signatures
)

Parameters

Name Type Description
filePath String

The path to a file into which to save the document.

signatures PdfSignatureBuilder[]

An array of signatures to apply to the document.

Remarks

Call the SaveDocument method to apply one or more signatures to the PDF document. Specify the document to be signed in the PdfDocumentSigner object’s constructor.

You can add a signature to the existing signature field. Create a new PdfSignatureBuilder object with the signature field’s name passed as the constructor’s parameter.

Use the PdfSignatureFieldInfo instance in the PdfSignatureBuilder object constructor to create a new signature field. You can specify the field’s name, bounds and rotation angle.

The PDF Document API supports PKCS#7 signatures. Use the Pkcs7Signer class to create this signature type. You can create a Pkcs7SignerBase descendant to use a custom object to create the PKCS#7 signature.

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

//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);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveDocument(String, PdfSignatureBuilder[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also