PDF Signing API
PDF Digital Signature API - Action: Sign PDF File using Signature Setting Name (SignatureSetting Name may be setup using Signer.Digital Webserver Console from Web Browser)
1. Sign using Signature Setting Name. Setting done in Signer.Digital UI:
Url: https//<baseurl>/api/SignPdfV1/SignPdfWithSettingName
HTTP Method: POST
BODY:
/// Payload for Hash Signing API Request with Sign Setting Name only
public class SignPdfWithSettingNameReq
{
/// Base64 encoded Pdf file to be signed
public byte[] PdfData { get; set; }
/// Hosted Signature Setting Name
public string SignSettingName { get; set; }
/// Hosted Certificate /Server Token User Pin - Optional - will override PIN saved in UI of SignSetting on Server
/// No need to set if Signature Source is 'FromBrowser'
public string TokenPin { get; set; }
/// API calling Application Profile Name - Only used for API Txn logging
public string AppProfileName { get; set; }
/// Sign PDF Document in AppendMode. Set to True for multiple signing, form filling, annotation, etc
public bool AppendMode { get; set; }
/// Sign PDF Document with Certify Docuent. Set to True if signature is showing invalid on scanned document.
public bool CertifyDoc { get; set; }
/// Password for pdf to be signed, if source pdf is password protected.
public string AdminPasswordForSourcePDF { get; set; }
/// Admin Password for Signed Output pdf.
public string AdminPasswordForOutputPDF { get; set; }
/// User Password for Signed Output pdf.
public string UserPasswordForOutputPDF { get; set; }
/// Document watermark to be applied to document before signing. Do not use in case of multiple signing.
public DocumentWatermark DocWaterMarkSetting { get; set; }
/// SDHubConnectionIdFromBrowser for signing from Browser
public string SDHubConnectionIdFromBrowser { get; set; }
/// CertificateFromBrowser for signing From Browser (Web Application)
public string CertificateFromBrowser { get; set; }
}
2. Sign using Signature Setting Data.:
Url: https//<baseurl>/api/SignPdfV1/SignPdfWithSetting
HTTP Method: POST
BODY:
/// <summary>
/// Payload for Hash Signing API Request with Sign Setting Complete data
/// Keep SignatureSettingName empty and pass the complete data of SignatureSetting
/// </summary>
public class SignPdfWithSettingReq : SignPdfWithSettingNameReq
{
/// <summary>
/// Complete Signature Setting Object
/// </summary>
public SignatureSetting signatureSetting { get; set; }
}
Signature Setting model is large model but producing one small working sampel of the SignatureSetting at the end of this page.
Response:
public class TxnRespWithFile
{
public bool IsSuccess;
public string ErrorCode;
public byte[] SignedFile;
public string TxnOutcome;
}
On API Success, SignedFile will have Signed PDF;
On API Error, TxnOutcome will have Error Message.
Sample Url: https://webserver.signer.digital/api/SignPdfV1/SignPdfWithSetting
SignatureSetting sample:
{
"SignatureSource": "FromBrowser",
"ApplyCustomSignatureSize": true,
"CustomSignatureWidth": 100.0,
"CustomSignatureHeight": 37.0,
"PositionSettings": {
"SignOnPage": "AllPages",
"SignaturePosition": "AboveSearchText",
"SearchText": "Signature",
"CustomPageNos": null,
"SignatureOffsetRight": 20.0,
"SignatureOffsetBottom": 50.0,
"SignatureOffsetLeft": 0.0,
"SignatureOffsetTop": 0.0,
"CustomPositionUpperX": 145.22244,
"CustomPositionUpperY": 61.68994,
"CustomPositionWidth": 0.0,
"CustomPositionHeight": 0.0
},
"ImageSettings": {
"CustomImagePosition": "BottomRight",
"CustomImage": null,
"CustomImageOffsetRight": 0.0,
"CustomImageOffsetBottom": 0.0,
"CustomImageOffsetLeft": 0.0,
"CustomImageOffsetTop": 0.0,
"ImageAsSignatureWatermark": false
},
"SignPageImageSettings": null,
"TextAppearenceSettings": {
"SignTextCNOnNewLine": false,
"OrganizationPrefix": "O: \\n",
"ShowOrganizationAsPerCertificate": false,
"StatePrefix": "S: ",
"ShowStateAsPerCertificate": false,
"PostalCodePrefix": "PostalCode: ",
"ShowPostalCodeAsPerCertificate": false,
"CountryPrefix": "C: ",
"ShowCountry": false,
"ReasonPrefix": "Reason: ",
"Reason": null,
"ShowReason": false,
"LocationPrefix": "Location: ",
"Location": null,
"ShowLocation": false,
"ContactPrefix": "Contact: ",
"Contact": null,
"ShowContact": false,
"DesignationPrefix": "Designation: ",
"Designation": null,
"ShowDesignation": false,
"SerialNoPrefix": "SERIALNUMBER: ",
"ShowCertificateSerialNo": false,
"CertificateIDPrefix": "Cid: ",
"ShowCertificateIDAsPerCertificate": false
},
"EnableValidationAppearance": true,
"DoNotDisplaySignatureText": false
}
---------------