Quick start
This guide walks you through a complete signature with the MobbSign Windows SDK: your app shows a PDF, the user signs it with their handwritten signature, and the SDK returns the signed document.
| # | Step | Call |
|---|---|---|
| 1 | Add the view | MobbSignView |
| 2 | Configure the license | ConfigureLicense() |
| 3 | Set the encryption key | SetEncryptionKey() |
| 4 | Listen to the events | On… += |
| 5 | Load the document | LoadPDFDocument() |
The SDK is installed and you have a license key and the public encryption key of your project.
1. Add the view
Create MobbSignView in your page and add it to the main container:
public MainPage()
{
this.InitializeComponent();
this.MobbSignView = new MobbSignView();
this.LayoutRoot.Children.Add(this.MobbSignView);
}
To customise the view, pass a dictionary of customisation properties to the constructor.
2. Configure the license
Configure the license before any other call:
this.MobbSignView.ConfigureLicense("YOUR_LICENSE_KEY");
The OnCheckLicense event notifies the result of the validation.
3. Set the encryption key
Set the public key that encrypts the biometric data of every signature:
this.MobbSignView.SetEncryptionKey(new Uri("ms-appx:///Assets/Keys/public.key"));
The OnCheckEncryptionKey event notifies whether the key is valid.
4. Listen to the events
Subscribe to the events you need:
this.MobbSignView.OnDocumentShown += MobbSignView_OnDocumentShown;
this.MobbSignView.OnSignButtonPressed += MobbSignView_OnSignButtonPressed;
this.MobbSignView.OnSignatureAcquised += MobbSignView_OnSignatureAcquised;
this.MobbSignView.OnSignatureDeleted += MobbSignView_OnSignatureDeleted;
this.MobbSignView.OnDocumentSigned += MobbSignView_OnDocumentSigned;
this.MobbSignView.OnDocumentFormSaved += MobbSignView_OnDocumentFormSaved;
this.MobbSignView.OnBackButtonPressed += MobbSignView_OnBackButtonPressed;
this.MobbSignView.OnProcessEnd += MobbSignView_OnProcessEnd;
this.MobbSignView.OnErrorOccurred += MobbSignView_OnErrorOccurred;
this.MobbSignView.OnCheckLicense += MobbSignView_OnCheckLicense;
this.MobbSignView.OnCheckEncryptionKey += MobbSignView_OnCheckEncryptionKey;
| Event | Raised when |
|---|---|
OnDocumentShown | The document has been loaded and shown. |
OnSignButtonPressed | The user taps Sign. |
OnSignatureAcquised | The user has drawn a signature, before it is confirmed. |
OnSignatureDeleted | The user has deleted the signature drawn. |
OnDocumentSigned | A signature has been added to the document. |
OnDocumentFormSaved | The form fields of the document have been saved. |
OnBackButtonPressed | The user taps Back. |
OnProcessEnd | The user has finished: the signed document is available. |
OnErrorOccurred | An error has occurred. |
OnCheckLicense | The license has been validated. |
OnCheckEncryptionKey | The encryption key has been checked. |
5. Load the document
StorageFile file = e.Parameter as StorageFile;
if (file != null)
{
await this.MobbSignView.LoadPDFDocument(file, "Service contract");
}
The document can also be loaded from its content, and its form fields can be filled in when it is loaded:
| Method | Loads the document |
|---|---|
Task LoadPDFDocument(StorageFile originFile, string name) | From a file. |
void LoadPDFDocument(StorageFile originFile, string name, Dictionary<string, object> inputFields) | From a file, filling in the form fields. |
Task LoadPDFDocumentFromData(byte[] data, string name) | From its content. |
void LoadPDFDocumentFromData(byte[] data, string name, Dictionary<string, object> inputFields) | From its content, filling in the form fields. |
The viewer opens the document. The user taps Sign, draws their signature and confirms it. When they finish, OnProcessEnd is raised.
Next step
Control the process from your own interface in Signing process.