|
// create an instance of Signature |
|
Signature signature = new Signature(@"C:\Files\sample.pdf"); |
|
|
|
List<SignOptions> listOptions = new List<SignOptions>(); |
|
|
|
// instantiate text form field signature |
|
TextFormFieldSignature textSignature = new TextFormFieldSignature("tbData1", "Enter Your Name"); |
|
// instantiate options based on text form field signature |
|
FormFieldSignOptions optionsTextFF = new FormFieldSignOptions(textSignature) |
|
{ |
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
VerticalAlignment = VerticalAlignment.Top, |
|
Margin = new Padding(20, 0, 138, 0), |
|
Height = 20, |
|
Width = 200 |
|
}; |
|
|
|
// instantiate radio-button form field signature |
|
List<string> radioOptions = new List<string>() { "Male", "Female" }; |
|
RadioButtonFormFieldSignature rbSignature = new RadioButtonFormFieldSignature("radioData1", radioOptions, "Male"); |
|
// instantiate options based on text form field signature |
|
FormFieldSignOptions optionsTextRB = new FormFieldSignOptions(rbSignature) |
|
{ |
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
VerticalAlignment = VerticalAlignment.Top, |
|
Margin = new Padding(20, 0, 170, 0), |
|
Height = 50, |
|
Width = 200, |
|
}; |
|
|
|
// instantiate combo box form field signature |
|
List<string> items = new List<string>() { "Australia", "United Kingdom", "United States" }; |
|
ComboboxFormFieldSignature cmbSignature = new ComboboxFormFieldSignature("combo1", items, "Australia"); |
|
// instantiate options based on text form field signature |
|
FormFieldSignOptions optionsTextCMB = new FormFieldSignOptions(cmbSignature) |
|
{ |
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
VerticalAlignment = VerticalAlignment.Top, |
|
Margin = new Padding(20, 0, 238, 0), |
|
Height = 20, |
|
Width = 200, |
|
}; |
|
|
|
// instantiate text form field signature |
|
CheckboxFormFieldSignature chbSignature = new CheckboxFormFieldSignature("chbData1", true); |
|
// instantiate options based on text form field signature |
|
FormFieldSignOptions optionsTextCHB = new FormFieldSignOptions(chbSignature) |
|
{ |
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
VerticalAlignment = VerticalAlignment.Top, |
|
Margin = new Padding(20, 0, 270, 0), |
|
Height = 20, |
|
Width = 20, |
|
}; |
|
|
|
|
|
// instantiate digital form field signature |
|
DigitalFormFieldSignature digSignature = new DigitalFormFieldSignature("dgData1"); |
|
// instantiate options based on text form field signature |
|
FormFieldSignOptions optionsTextDIG = new FormFieldSignOptions(digSignature) |
|
{ |
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
VerticalAlignment = VerticalAlignment.Top, |
|
Margin = new Padding(20, 0, 300, 0), |
|
Height = 50, |
|
Width = 200, |
|
}; |
|
|
|
// add form fields to sign options list |
|
listOptions.Add(optionsTextFF); |
|
listOptions.Add(optionsTextCHB); |
|
listOptions.Add(optionsTextRB); |
|
listOptions.Add(optionsTextCMB); |
|
listOptions.Add(optionsTextDIG); |
|
|
|
// sign document to file |
|
signature.Sign(@"C:\Files\Signature\sample_output.pdf", listOptions); |