Skip to main content

Signature

Namespace: Wisej.Web.Ext.Syncfusion2

Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)

The Signature control is a user interface to draw the signature digitally. The Signature control is displayed as a container where end-user can sign their name as a verified signature inside the container.

public class Signature : ej2Base

Constructors​

Instance member Signature()​

Constructs a new instance of the Signature class.

Example:

The following example creates a signature pad and sets the colors through the Options object.

var signature = new Signature();
signature.Options.backgroundColor = "#ffffff";
signature.Options.strokeColor = "#003399";
signature.Size = new Size(400, 150);
this.Controls.Add(signature);

Instance member Signature(options)​

Constructs a new instance of the Signature class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a signature pad that draws thicker strokes, and clears it when the user clicks a button.

var signature = new Signature(new
{
strokeColor = "#000000",
minStrokeWidth = 1,
maxStrokeWidth = 4
});
signature.Size = new Size(400, 150);
this.Controls.Add(signature);

this.buttonClear.Click += (s, e) => signature.Instance.clear();

Methods​

Instance member GetSignatureAsync()​

Returns an image of the signature drawn by the user, retrieved asynchronously from the browser.

Returns: Task<Image>. A task that represents the asynchronous operation. The result is a Bitmap with the image of the signature.

The signature is saved in the browser in the PNG format and transferred to the server as a base64 data URL. The method can be called only after the widget has been created in the browser. When the user has not signed yet, the returned image is blank: use the isEmpty method of the widget to check whether there is a signature.

Example:

The following example saves the signature to a PNG file when the user clicks a button.

private async void buttonSave_Click(object sender, EventArgs e)
{
bool empty = await this.signature1.Instance.isEmptyAsync();
if (empty)
{
AlertBox.Show("Please sign the document.");
return;
}

using (var image = await this.signature1.GetSignatureAsync())
{
image.Save(Application.MapPath("signature.png"), ImageFormat.Png);
}
}

Implements​