Class SignatureField
Represents a signature field in the SfPdfViewer2 component, enabling users to add signatures to PDF documents.
Inherited Members
Namespace: Syncfusion.Blazor.SfPdfViewer
Assembly: Syncfusion.Blazor.SfPdfViewer.dll
Syntax
public class SignatureField : FormFieldInfo
Remarks
The SignatureField class allows users to apply signatures within the PDF Viewer component. It supports various signature types, including drawn, typed, and image-based signatures. The appearance, position, and required status of the signature field can be customized. Signature fields can be added dynamically or through pre-existing form fields in the PDF document.
Examples
The following example demonstrates how to create a signature field and add it to the PDF Viewer:
SignatureField signatureField = new SignatureField();
signatureField.IsRequired = true, // Marks the signature field as required
signatureField.BackgroundColor = "#E0E0E0" // Sets the background color of the signature field
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { signatureField });
Constructors
SignatureField()
Initializes a new instance of the SignatureField class in the SfPdfViewer2 component.
Declaration
public SignatureField()
Remarks
This constructor creates a new signature field with default properties, setting the field type to SignatureField. The created signature field allows users to add drawn, typed, or image-based signatures in the PDF Viewer. Additional properties such as IsRequired, BackgroundColor, and BorderColor can be customized to modify the appearance and behavior of the signature field.
Examples
The following example demonstrates how to create a signature field and set its properties:
SignatureField signatureField = new SignatureField()
{
Name = "UserSignature",
IsRequired = true, // Marks the signature field as mandatory
BackgroundColor = "#E0E0E0", // Sets the background color
BorderColor = "#000000" // Sets the border color
};
Properties
Value
Gets or sets the signature value in the SignatureField of the SfPdfViewer2 component.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the signature content, either in plain text or base64-encoded format. |
Remarks
This property holds the signature content, which can represent a drawn path, typed text, or image-based signature. The value can be assigned as a base64-encoded string when representing an image or drawn signature, or as plain text for typed signatures.
Examples
The following example demonstrates how to set the signature value as typed text:
SignatureField signatureField = new SignatureField()
{
Name = "UserSignature",
IsRequired = true
};
signatureField.Value = "John Doe"; // Sets the typed text as the signature value