Class PdfLoadedSignatureField
Represents the signature field of an existing PDF document.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfLoadedSignatureField : PdfLoadedStyledField, IPdfWrapper, INotifyPropertyChanged
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Gets the signature field
PdfLoadedSignatureField signatureField = doc.Form.Fields["ManagerSignature"] as PdfLoadedSignatureField;
signatureField.Flatten = true;
doc.Save("LoadedForm.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = TryCast(doc.Form.Fields("ManagerSignature"), PdfLoadedSignatureField)
signatureField.Flatten = True
doc.Save("LoadedForm.pdf")
doc.Close(True)
Properties
IsSigned
Checks whether the signature field is signed or not
Declaration
public bool IsSigned { get; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value specifying the digital signature field have signature data or not. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Read the first page
PdfPageBase page = doc.Pages[0];
// Gets the signature field
PdfLoadedSignatureField signatureField = doc.Form.Fields["ManagerSignature"] as PdfLoadedSignatureField;
// Checks whether the signature field is signed or not
bool isSigned = signatureField.IsSigned;
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Read the first page
Dim page As PdfPageBase = doc.Pages(0)
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = TryCast(doc.Form.Fields("ManagerSignature"), PdfLoadedSignatureField)
' Checks whether the signature field is signed or not
Dim isSigned As Boolean = signatureField.IsSigned
doc.Close(True)
See Also
Items
Gets the collection of signature items.[Read-Only]
Declaration
public PdfLoadedSignatureItemCollection Items { get; }
Property Value
Type | Description |
---|---|
PdfLoadedSignatureItemCollection |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Read the signature field
PdfLoadedSignatureField signatureField = doc.Form.Fields[0] as PdfLoadedSignatureField;
// Signature Item collection
PdfLoadedSignatureItemCollection signatureFieldCollection = signatureField.Items;
// Read the signature Item
PdfLoadedSignatureItem signatureFieldItem = signatureFieldCollection[0] as PdfLoadedSignatureItem;
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Read the signature field
Dim signatureField As PdfLoadedSignatureField = TryCast(doc.Form.Fields(0), PdfLoadedSignatureField)
' Signature Item collection
Dim signatureFieldCollection As PdfLoadedSignatureItemCollection = signatureField.Items
Dim signatureFieldItem As PdfLoadedSignatureItem = TryCast(signatureFieldCollection(0), PdfLoadedSignatureItem)
doc.Save("Form.pdf")
doc.Close(True)
See Also
Signature
Gets or sets the digital signature for signing the field.
Declaration
public PdfSignature Signature { get; set; }
Property Value
Type | Description |
---|---|
PdfSignature | A PdfSignature object specifying the digital signature for signing the field. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Read the first page
PdfPageBase page = doc.Pages[0];
// Gets the signature field
PdfLoadedSignatureField signatureField = doc.Form.Fields["ManagerSignature"] as PdfLoadedSignatureField;
// Create a new Signature
PdfCertificate pdfCert = new PdfCertificate("Pdf.pfx", "123");
PdfSignature signature = new PdfSignature(doc, page, pdfCert, "Signature");
signature.Bounds = new RectangleF(new PointF(5, 5), new SizeF(100, 200));
// Set the signature of the field
signatureField.Signature = signature;
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Read the first page
Dim page As PdfPageBase = doc.Pages(0)
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = TryCast(doc.Form.Fields("ManagerSignature"), PdfLoadedSignatureField)
' Create a new Signature
Dim pdfCert As PdfCertificate = New PdfCertificate("Pdf.pfx", "123")
Dim signature As PdfSignature = New PdfSignature(doc, page, pdfCert, "Signature")
signature.Bounds = New RectangleF(New PointF(5, 5), New SizeF(100, 200))
' Set the signature of the field
signatureField.Signature = signature
doc.Save("Form.pdf")
doc.Close(True)
See Also
Methods
ValidateSignature()
Specifies the signatures's validation result.
Declaration
public PdfSignatureValidationResult ValidateSignature()
Returns
Type | Description |
---|---|
PdfSignatureValidationResult |
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
// Validate signature and get validation result
PdfSignatureValidationResult result = signatureField.ValidateSignature();
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
' Validate signature and get validation result
Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature()
' Close the document
document.Close(true)
ValidateSignature(PdfSignatureValidationOptions)
Declaration
public PdfSignatureValidationResult ValidateSignature(PdfSignatureValidationOptions options)
Parameters
Type | Name | Description |
---|---|---|
PdfSignatureValidationOptions | options |
Returns
Type | Description |
---|---|
PdfSignatureValidationResult |
ValidateSignature(X509CertificateCollection)
Specifies the signatures's validation result with X509Certificate collection.
Declaration
public PdfSignatureValidationResult ValidateSignature(X509CertificateCollection rootCertificates)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.X509CertificateCollection | rootCertificates |
Returns
Type | Description |
---|---|
PdfSignatureValidationResult |
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
// Collection of X509Certificate
X509CertificateCollection certificates = new X509CertificateCollection();
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"));
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
// Validate signature and get validation result
PdfSignatureValidationResult result = signatureField.ValidateSignature(certificates);
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
' Collection of X509Certificate
Dim certificates As X509CertificateCollection = New X509CertificateCollection()
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"))
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
' Validate signature and get validation result
Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature(certificates)
' Close the document
document.Close(true)
ValidateSignature(X509CertificateCollection, PdfSignatureValidationOptions)
Specifies the signatures's validation result with X509Certificate collection with validation option
Declaration
public PdfSignatureValidationResult ValidateSignature(X509CertificateCollection rootCertificates, PdfSignatureValidationOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Cryptography.X509Certificates.X509CertificateCollection | rootCertificates | |
PdfSignatureValidationOptions | options |
Returns
Type | Description |
---|---|
PdfSignatureValidationResult |
Examples
// Loads an existing document
PdfLoadedDocument document = new PdfLoadedDocument(fileName);
// Gets the signature field
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
// Collection of X509Certificate
X509CertificateCollection certificates = new X509CertificateCollection();
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"));
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
PdfSignatureValidationOptions options = new PdfSignatureValidationOptions();
// disable revocation status
options.ValidateRevocationStatus = false;
// Validate signature and get validation result
PdfSignatureValidationResult result = signatureField.ValidateSignature(certificates, options);
// Close the document
document.Close(true);
' Loads an existing document
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileName)
' Gets the signature field
Dim signatureField As PdfLoadedSignatureField = document.Form.Fields[0] As PdfLoadedSignatureField
' Collection of X509Certificate
Dim certificates As X509CertificateCollection = New X509CertificateCollection()
certificates.Add(X509Certificate.CreateFromCertFile("certificate1.cer"))
certificates.Add(X509Certificate.CreateFromCertFile("certificate2.cer"))
' Signature validation options
Dim options As PdfSignatureValidationOptions = New PdfSignatureValidationOptions()
' disable revocation status
options.ValidateRevocationStatus = False
' Validate signature and get validation result
Dim result As PdfSignatureValidationResult = signatureField.ValidateSignature(certificates, options)
' Close the document
document.Close(true)
Implements
System.ComponentModel.INotifyPropertyChanged