officefileapi-devexpress-dot-pdf-dot-pdfdocumentsigner-dot-getsignaturefieldnames-x28-system-dot-boolean-x29.md
Retrieves names of signature fields.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public IList<string> GetSignatureFieldNames(
bool emptyFieldsOnly
)
Public Function GetSignatureFieldNames(
emptyFieldsOnly As Boolean
) As IList(Of String)
| Name | Type | Description |
|---|---|---|
| emptyFieldsOnly | Boolean |
true to retrieve names of not signed fields only; otherwise, false.
|
| Type | Description |
|---|---|
| IList<String> |
A list of form fields’ names.
|
Use the GetSignatureNames method to get names of signed form fields. You can use the PdfDocumentSigner.ClearSignatureField to clear the signed field.
The code sample below shows how to retrieve signed form field names and apply a new signature to the first field:
using DevExpress.Pdf;
using System.Diagnostics;
using System.IO;
using DevExpress.Office.DigitalSignatures;
// Load a document to sign:
using (var signer = new PdfDocumentSigner("Document.pdf"))
{
// Create a PKCS#7 signature:
Pkcs7Signer pkcs7Signature = new Pkcs7Signer("Signing Documents//certificate.pfx", "123",
HashAlgorithmType.SHA256);
// Retrieve all signed form fields:
var signedFields = signer.GetSignatureFieldNames(false);
// Clear the first signature field:
signer.ClearSignatureField(signedFields[0]);
// Apply a new signature to this form field:
var santuzzaSignature = new PdfSignatureBuilder(pkcs7Signature, signedFields[0]);
// Specify image and signer information:
santuzzaSignature.SetImageData(File.ReadAllBytes("Signing Documents//SantuzzaValentina.jpg"));
santuzzaSignature.Location = "Australia";
santuzzaSignature.Name = "Santuzza Valentina";
santuzzaSignature.Reason = "I Agree";
santuzzaSignature.CertificationLevel = PdfCertificationLevel.FillFormsAndAnnotate;
// Sign and save the document:
signer.SaveDocument("SignedDocument.pdf", santuzzaSignature);
}
Imports DevExpress.Pdf
Imports System.Diagnostics
Imports System.IO
Imports DevExpress.Office.DigitalSignatures
' Load a document to sign:
Using signer = New PdfDocumentSigner("Document.pdf")
' Create a PKCS#7 signature:
Dim pkcs7Signature As New Pkcs7Signer("Signing Documents//certificate.pfx", "123",
HashAlgorithmType.SHA256)
' Retrieve all signed form fields:
Dim signedFields = signer.GetSignatureFieldNames(False)
' Clear the first signature field:
signer.ClearSignatureField(signedFields(0))
' Apply a new signature to this form field:
Dim santuzzaSignature = New PdfSignatureBuilder(pkcs7Signature, signedFields(0))
' Specify image and signer information:
santuzzaSignature.SetImageData(File.ReadAllBytes("Signing Documents//SantuzzaValentina.jpg"))
santuzzaSignature.Location = "Australia"
santuzzaSignature.Name = "Santuzza Valentina"
santuzzaSignature.Reason = "I Agree"
santuzzaSignature.CertificationLevel = PdfCertificationLevel.FillFormsAndAnnotate
' Sign and save the document:
signer.SaveDocument("SignedDocument.pdf", santuzzaSignature)
End Using
See Also