Electronic Signatures - Overview
The SDK allows your recipients to electronically sign PDF documents.
Available Zone Types
| Type | Method | Description |
|---|---|---|
| Signature | CreateFieldSignZone |
Handwritten signature zone |
| Initials | CreateFieldInitialZone |
Initials zone |
| Text Box | CreateFieldTextZone |
Single-line text field |
| Text Area | CreateFieldTextAreaZone |
Multiline text field |
| Date | CreateFieldDateZone |
Date picker |
| Date Sign | CreateFieldDateSignZone |
Auto-filled date when signature is applied |
| Number | CreateFieldNumberZone |
Field restricted to numeric characters |
| Checkbox | CreateFieldCheckBoxZone |
Checkbox |
| Radio Button | CreateFieldRadioZone |
Option within a group. Only one selection allowed per group |
| Dropdown | CreateFieldDropdownZone |
Compact dropdown menu |
| Option List | CreateFieldOptionListZone |
Expanded selection list |
Signature Workflow
1. Prepare the PDF
|
v
2. Define signature zones with SignHelper
|
v
3. Associate zones with recipients
|
v
4. Send with MessageHelper.MultiRecipientMessage()
|
v
5. Recipient signs via web interface
|
v
6. Retrieve signed document
Quick Example
using SecureExchangesSDK.Helpers;
using SecureExchangesSDK.Models.Args;
using SecureExchangesSDK.Models.Entity;
using SecureExchangesSDK.Models.JSON;
using SecureExchangesSDK.Models.Transport;
using SecureExchangesSDK.SecureExchanges;
// 1. File to sign
string pdfPath = @"C:\contract.pdf";
string sha512 = CryptoHelper.GetSHA512OfFile(pdfPath);
// List indicating which files require a signature
List<SignFilesRequired> signFiles = new List<SignFilesRequired>
{
new SignFilesRequired {
SHA512 = sha512
}
};
// 2. Create signature zones using the helper methods
// ZoneBuilder use filePath to auto-read PDF dimensions
ZoneBuilder zoneBuilder = new ZoneBuilder(pdfPath, false);
var zones = new SignZoneDetails[]
{
zoneBuilder.CreateFieldSignZone(
1, // page number
"signature1", // field name
100, 650, // x, y position
200, 50), // width, height
zoneBuilder.CreateFieldDateSignZone(
1, // page number
"date1", // field name
100, 600, // x, y position
100, 25, // width, height
12) // font size
};
// 3. Associate with recipients
var recipient = new RecipientInfo { Email = "client@example.com" };
var recipientIndex = new Dictionary<RecipientInfo, List<FileZoneDefinition>>
{
{
recipient,
new List<FileZoneDefinition>
{
new FileZoneDefinition
{
UniqueName = sha512,
ZonesDef = new SignZoneDefinition { Zones = zones }
}
}
}
};
// 4. Configure sending
var recipients = new List<RecipientInfo> { recipient };
Uri endpoint = new Uri("https://www.secure-exchanges.com/_api/0217/0217.asmx");
string message = "Please sign this contract";
string subject = "Contract to Sign";
string password = null; // Optional password to open the message
SendMethodEnum sendMethod = SendMethodEnum.onlyEmail;
string culture = "en-CA"; // Signature interface language
int maximumOpenTime = 5; // Maximum number of opens
int minutesExpiration = 10080; // 1 week (in minutes)
bool getBackHtml = false; // Returns the email HTML to send via your own SMTP server
bool showSubject = true; // DEPRECATED
bool getNotify = true; // Enable open notification
var args = new MutliRecipientArgs(
endpoint,
serial,
apiUser,
apiPassword,
recipients,
message,
subject,
password,
null,
sendMethod,
getBackHtml,
showSubject,
getNotify,
culture,
maximumOpenTime,
minutesExpiration
){
FilesPath = new List<string> { pdfPath },
FileToSign = signFiles,
SignRecipientsZoneDef = SignHelper.ConvertRecipientIndexToList(recipientIndex),
OwnerDontNeedToSign = true,
};
// 5. Send
var response = MessageHelper.MultiRecipientMessage(args);