Class SignHelper
Helper class for managing digital signature zones and PDF document signing operations. Provides methods for creating, validating, and processing signature zones on PDF documents.
Inherited Members
Namespace: SecureExchangesSDK.Helpers
Assembly: SecureExchangesSDK.dll
Syntax
public static class SignHelper
Remarks
This class works in conjunction with MessageHelper to enable document signing workflows. Signature zones define where recipients can sign, add text, dates, checkboxes, or initials on PDF documents.
Examples
// Create a dictionary to hold recipient zone definitions
var recipientIndex = new Dictionary<RecipientInfo, List<FileZoneDefinition>>();
var recipient = new RecipientInfo { Email = "signer@example.com" };
// Add zone definitions for the recipient
recipientIndex[recipient] = new List<FileZoneDefinition>
{
new FileZoneDefinition
{
UniqueName = sha512Hash,
ZonesDef = new SignZoneDefinition { Zones = signZoneArray }
}
};
// Convert to list for use with MultiRecipientMessage
var zoneDefList = SignHelper.ConvertRecipientIndexToList(recipientIndex);
Fields
CERTIFICATE_STRING
The certificate string used to identify Secure Exchanges certification signatures in PDF documents.
Declaration
public const string CERTIFICATE_STRING = "---------------Secure Exchanges certificate---------------"
Field Value
| Type | Description |
|---|---|
| string |
Methods
AddFileZoneDefToRecipientIndex(Dictionary<RecipientInfo, List<FileZoneDefinition>>, IEnumerable<SignTemplateRecipient>, string, params KeyValuePair<string, RecipientInfo>[])
This method is convert, zone template to definitionzones for recipients
Declaration
public static Dictionary<RecipientInfo, List<FileZoneDefinition>> AddFileZoneDefToRecipientIndex(Dictionary<RecipientInfo, List<FileZoneDefinition>> recipientIndex, IEnumerable<SignTemplateRecipient> templateZones, string SHA512, params KeyValuePair<string, RecipientInfo>[] recipientsMatch)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<RecipientInfo, List<FileZoneDefinition>> | recipientIndex | Dictionnary by recipients for zones file definitions |
| IEnumerable<SignTemplateRecipient> | templateZones | The template zone we need to convert |
| string | SHA512 | The SHA512 of the file |
| KeyValuePair<string, RecipientInfo>[] | recipientsMatch | The template match name, and the recipient associated with that name |
Returns
| Type | Description |
|---|---|
| Dictionary<RecipientInfo, List<FileZoneDefinition>> |
ConcatRecipientZoneDefinitionLists(List<RecipientZoneDefinition>, List<RecipientZoneDefinition>)
Concats 2 RecipientZoneDefinition lists
Declaration
public static List<RecipientZoneDefinition> ConcatRecipientZoneDefinitionLists(List<RecipientZoneDefinition> list1, List<RecipientZoneDefinition> list2)
Parameters
| Type | Name | Description |
|---|---|---|
| List<RecipientZoneDefinition> | list1 | |
| List<RecipientZoneDefinition> | list2 |
Returns
| Type | Description |
|---|---|
| List<RecipientZoneDefinition> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | |
| Exception |
ConvertRecipientIndexToList(Dictionary<RecipientInfo, List<FileZoneDefinition>>)
Take a recipient FileZoneDefinition dictionnary and transform it to a list of RecipientZoneDefinition In fact, that mean the FileZoneDefinition are grouped by Recipients for the sign process
Declaration
public static List<RecipientZoneDefinition> ConvertRecipientIndexToList(Dictionary<RecipientInfo, List<FileZoneDefinition>> recipientIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<RecipientInfo, List<FileZoneDefinition>> | recipientIndex | The dictionnary previously build. User the AddFileZoneDefToRecipientIndex to fill your dictionnary with a template |
Returns
| Type | Description |
|---|---|
| List<RecipientZoneDefinition> | Return the list of RecipientZoneDefinition that could be use by the MultiRecipientMessage method |
CreateFieldCheckBoxZone(string, int, string, float, float, float, float, bool, bool)
Creates a checkbox zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldCheckBoxZone(string filePath, int page, string fieldName, float x, float y, float width, float height, bool isChecked = false, bool required = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the checkbox field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the checkbox |
| float | height | Height of the checkbox |
| bool | isChecked | Default checked state |
| bool | required | Whether the checkbox is required |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a checkbox zone |
Examples
var checkboxZone = SignHelper.CreateFieldCheckBoxZone(filePath, 1, "myCheckBox", 10, 100, 20, 20, false, true);
CreateFieldDateSignZone(string, int, string, float, float, float, float, float, string)
Creates a date signature zone (auto-filled with signature date) on a PDF document.
Declaration
public static SignZoneDetails CreateFieldDateSignZone(string filePath, int page, string fieldName, float x, float y, float width, float height, float fontSize = 12, string dateFormat = "dd-MM-yyyy")
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the date field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the date zone |
| float | height | Height of the date zone |
| float | fontSize | Font size for the date |
| string | dateFormat | Date format string (e.g., "dd-MM-yyyy") |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a date signature zone |
Examples
var dateSignZone = SignHelper.CreateFieldDateSignZone(filePath, 1, "myDateSign", 10, 500, 100, 40, 12, "dd-MM-yyyy");
CreateFieldDateZone(string, int, string, float, float, float, float, float, string)
Creates a date picker zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldDateZone(string filePath, int page, string fieldName, float x, float y, float width, float height, float fontSize = 12, string dateFormat = "MM-dd-yyyy")
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the date field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the date zone |
| float | height | Height of the date zone |
| float | fontSize | Font size for the date |
| string | dateFormat | Date format string (e.g., "MM-dd-yyyy") |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a date picker zone |
Examples
var dateZone = SignHelper.CreateFieldDateZone(filePath, 1, "myDatePicker", 10, 400, 100, 40, 24, "MM-dd-yyyy");
CreateFieldInitialZone(string, int, string, float, float, float, float)
Creates an initials zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldInitialZone(string filePath, int page, string fieldName, float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the initials field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the initials zone |
| float | height | Height of the initials zone |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for an initials zone |
Examples
var initialsZone = SignHelper.CreateFieldInitialZone(filePath, 1, "myInitial", 10, 200, 100, 40);
CreateFieldNumberZone(string, int, string, float, float, float, float, string, float)
Creates a number input zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldNumberZone(string filePath, int page, string fieldName, float x, float y, float width, float height, string defaultValue = "", float fontSize = 12)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the number field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the number zone |
| float | height | Height of the number zone |
| string | defaultValue | Default number value |
| float | fontSize | Font size for the number |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a number zone |
Examples
var numberZone = SignHelper.CreateFieldNumberZone(filePath, 1, "myNumber", 10, 600, 100, 40, "", 24);
CreateFieldRadioZone(string, int, string, float, float, float, float, string, bool)
Creates a radio button zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldRadioZone(string filePath, int page, string fieldName, float x, float y, float width, float height, string radioId, bool isSelected = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Name for the radio group (use same name for grouped radio buttons) |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the radio button |
| float | height | Height of the radio button |
| string | radioId | Unique identifier for this radio option |
| bool | isSelected | Whether this radio is selected by default |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a radio button zone |
Examples
var radioZone = SignHelper.CreateFieldRadioZone(filePath, 1, "myRadio_g1", 10, 60, 20, 20, Guid.NewGuid().ToString(), false);
CreateFieldSignZone(string, int, string, float, float, float, float)
Creates a signature zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldSignZone(string filePath, int page, string fieldName, float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the signature field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the signature zone |
| float | height | Height of the signature zone |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a signature zone |
Examples
var signZone = SignHelper.CreateFieldSignZone(filePath, 1, "mySignature", 10, 300, 100, 40);
CreateFieldTextZone(string, int, string, float, float, float, float, string, float, bool)
Creates a text input zone on a PDF document.
Declaration
public static SignZoneDetails CreateFieldTextZone(string filePath, int page, string fieldName, float x, float y, float width, float height, string defaultValue = "", float fontSize = 12, bool required = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the PDF file (used to read page dimensions) |
| int | page | Page number (1-based) |
| string | fieldName | Unique name for the text field |
| float | x | X coordinate position on the page |
| float | y | Y coordinate position on the page |
| float | width | Width of the text zone |
| float | height | Height of the text zone |
| string | defaultValue | Default text value |
| float | fontSize | Font size for the text |
| bool | required | Whether the field is required |
Returns
| Type | Description |
|---|---|
| SignZoneDetails | A configured SignZoneDetails object for a text zone |
Examples
var textZone = SignHelper.CreateFieldTextZone(filePath, 1, "myText", 10, 700, 100, 40, "Default text", 20, true);
GetCertificationToken(GetCertificationTokenSDKArgs, CertificationMetadata)
Retrieves a certification token
Declaration
public static GetCertificationTokenResponse GetCertificationToken(GetCertificationTokenSDKArgs args, CertificationMetadata metadata = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetCertificationTokenSDKArgs | args | |
| CertificationMetadata | metadata |
Returns
| Type | Description |
|---|---|
| GetCertificationTokenResponse |
ValidateDocumentSignatureIntegrity(ValidateDocumentSignatureIntegrity_args)
VAlidate the document integrity of a signed file
Declaration
public static ValidateDocumentSignatureIntegrityResponse ValidateDocumentSignatureIntegrity(ValidateDocumentSignatureIntegrity_args args)
Parameters
| Type | Name | Description |
|---|---|---|
| ValidateDocumentSignatureIntegrity_args | args |
Returns
| Type | Description |
|---|---|
| ValidateDocumentSignatureIntegrityResponse |