Sign document with digital signature

A digital electronic signature is a scheme for verifying the document’s authenticity. A valid digital signature gives a recipient very strong reason to believe that the document was created or updated by a known sender and that the document was not altered by unknown source. For documents, the digital signature is represented by certificate with private (to sign) and public (to verify) keys. Most often certificates of various public key cryptography standards are used for this purpose, for example PFX format (see specification here). These digital signature certificates could be obtained from the operation system or generated manually with proper tools or trusted sources.

Digital signature as certificate file of PFX format allows to sign document after each creation or change with certificate and specify several optional parameters like subject, title, reason, contact etc. Most document viewers or editors support digital signatures verification that allows users to ensure document is from trusted source. Office documents format such as Word processing documents (DOC, DOCX, ODT, OTT), Spreadsheet files (XLSX, XLS, ODS, OTS) support digital signature without any visual appearance on document pages. PDF document format supports digital signature with alternative visual appearance on specific document page with custom image and labels. Picture below shows how digital signature looks by default on PDF document page..


GroupDocs.Signature Cloud supports creation of digital signature based on existing PFX certificate. It allows to adjust digital signature properties in the document:

  • Certificate source from FilePath;
  • Certificate password;
  • Contact, Reason and Location properties to set additional description;
  • Visible property to specify whether signature should be visible on document page or not;
  • XAdES type to specify whether e-signature should be of Xml Advanced Electronic Signature type.

API usage

There are steps that usage of GroupDocs.Signature Cloud consists of:

  1. Upload input document into cloud storage and other files, like digital certificate or image stamp
  2. Sign document
  3. Download output document

For storage operations, like uploading or downloading documents, please refer to the corresponding articles of this manual.

Swagger UI lets you call this REST API directly from the browser.

cURL example

// First get JSON Web Token
// Please get your Client Id and Client Secret from Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
curl -v "" \
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

// cURL example to get document information
curl -v "" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer <jwt token>"
-d "{
  'FileInfo': {
    'FilePath': 'signaturedocs/sample2.pdf'
  'Options': [
      'AllPages': true,
      'SignatureType': 'Digital',
      'ImageFilePath': 'signaturedocs/signature.jpg',
      'CertificateFilePath': 'signaturedocs/temp.pfx',
      'Password': '1234567890',
      'Left': 100,
      'Top': 100,
      'Width': 200,
      'Height': 200
  'SaveOptions': {
    'OutputFilePath': 'signaturedocs/signedDigital_sample2.pdf'
  "fileInfo": {
    "filePath": "signaturedocs/signedDigital_sample2.pdf",
    "storageName": null,
    "versionId": null,
    "password": null
  "size": 242705,
  "downloadUrl": "",
  "succeeded": [
      "comments": "",
      "isValid": false,
      "signTime": "2020-07-21T10:10:24.8866737+00:00",
      "signatureType": "Digital",
      "pageNumber": 1,
      "signatureId": "62cde234-3004-4c00-882a-e51c231fd205",
      "isSignature": true,
      "createdOn": "2020-07-21T10:10:27.5765385+00:00",
      "modifiedOn": "2020-07-21T10:10:27.5765385+00:00",
      "top": 492,
      "left": 100,
      "width": 200,
      "height": 200
      "comments": "",
      "isValid": false,
      "signTime": "2020-07-21T10:10:27.7705402+00:00",
      "signatureType": "Digital",
      "pageNumber": 2,
      "signatureId": "41a0ac7b-10e6-4bde-93e8-337f0509db43",
      "isSignature": true,
      "createdOn": "2020-07-21T10:10:28.1215393+00:00",
      "modifiedOn": "2020-07-21T10:10:28.1215393+00:00",
      "top": 492,
      "left": 100,
      "width": 200,
      "height": 200
  "failed": []

SDK examples

The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here.

// For complete examples and data files, please go to
string MyClientSecret = ""; // Get ClientId and ClientSecret from
string MyClientId = ""; // Get ClientId and ClientSecret from

var configuration = new Configuration(MyClientId, MyClientSecret);
var apiInstance = new SignApi(configuration);
// Sign options
var options = new SignDigitalOptions
    SignatureType = SignatureTypeEnum.Digital,
    ImageFilePath = "signature.jpg",
    CertificateFilePath = "temp.pfx",
    Password = "1234567890",
    Left = 100,
    Top = 100,
    Width = 200,
    Height = 200,
    LocationMeasureType = SignImageOptions.LocationMeasureTypeEnum.Pixels,
    SizeMeasureType = SignImageOptions.SizeMeasureTypeEnum.Pixels,
    RotationAngle = 0,
    HorizontalAlignment = SignImageOptions.HorizontalAlignmentEnum.None,
    VerticalAlignment = SignImageOptions.VerticalAlignmentEnum.None,
    Margin = new Padding {All = 5},
    MarginMeasureType = SignImageOptions.MarginMeasureTypeEnum.Pixels,
    AllPages = false,
    Page = 1,
    PagesSetup = new PagesSetup
        EvenPages = false,
        FirstPage = true,
        LastPage = false,
        OddPages = false,
        PageNumbers = new List<int?> {1}
// Sign settings.
var signSettings = new SignSettings
    FileInfo = new Sdk.Model.FileInfo
        FilePath = "sample2.pdf"
    SaveOptions = new SaveOptions { OutputFilePath = "signedDigital_sample2.pdf", SaveFormat = "pdf" },
    Options = new List<SignOptions> { options }
// Create request.
var request = new CreateSignaturesRequest(signSettings);
// Call api method with request.
var response = apiInstance.CreateSignatures(request);

// For complete examples and data files, please go to
String MyClientSecret = ""; // Get ClientId and ClientSecret from
String MyClientId = ""; // Get ClientId and ClientSecret from

Configuration configuration = new Configuration(MyClientId, MyClientSecret);
SignApi apiInstance = new SignApi(configuration);

FileInfo fileInfo = new FileInfo();

InfoSettings infoSettings = new InfoSettings();

SignDigitalOptions options = new SignDigitalOptions();

// set signature properties

// set signature position on a page

Padding padding = new Padding();

*set pages for signing (each of these page settings could be used singly)

PagesSetup pagesSetup = new PagesSetup();

SaveOptions saveOptions = new SaveOptions();

SignSettings signSettings = new SignSettings();

CreateSignaturesRequest request = new CreateSignaturesRequest(signSettings);

SignResult response = apiInstance.createSignatures(request);

// For complete examples and data files, please go to
use GroupDocs\Signature\Model;
use GroupDocs\Signature\Model\Requests;

$ClientId = ""; // Get ClientId and ClientSecret from
$ClientSecret = ""; // Get ClientId and ClientSecret from

$configuration = new GroupDocs\Signature\Configuration();

$apiInstance = new GroupDocs\Signature\SignApi($configuration);

$fileInfo = new GroupDocs\Signature\Model\FileInfo();

$settings = new GroupDocs\Signature\Model\SignSettings();

$saveOptions = new GroupDocs\Signature\Model\SaveOptions();

$options = new GroupDocs\Signature\Model\SignDigitalOptions();

$padding = new GroupDocs\Signature\Model\Padding();

$pagesSetup = new GroupDocs\Signature\Model\PagesSetup();


$request = new GroupDocs\Signature\Model\Requests\createSignaturesRequest($settings);
$response = $apiInstance->createSignatures($request);

// For complete examples and data files, please go to
global.signature_cloud = require("groupdocs-signature-cloud");

global.clientId = "XXXX-XXXX-XXXX-XXXX"; // Get ClientId and ClientSecret from
global.clientSecret = "XXXXXXXXXXXXXXXX"; // Get ClientId and ClientSecret from

global.signApi = signature_cloud.SignApi.fromKeys(clientId, clientSecret);

let fileInfo = new signature_cloud.FileInfo();
fileInfo.filePath = "signaturedocs/sample2.pdf";

let opts = new signature_cloud.SignDigitalOptions();
opts.signatureType = signature_cloud.OptionsBase.SignatureTypeEnum.Digital;
opts.imageFilePath = "signaturedocs/signature.jpg";
opts.certificateFilePath = "signaturedocs/temp.pfx";
opts.password = "1234567890";

let settings = new signature_cloud.SignSettings();
settings.fileInfo = fileInfo;
settings.options = [opts];

settings.saveOptions = new signature_cloud.SaveOptions();
settings.saveOptions.outputFilePath = "signaturedocs/signedDigital_sample2.pdf";

let request = new signature_cloud.CreateSignaturesRequest(settings);
let response = await signApi.createSignatures(request);

# For complete examples and data files, please go to
from groupdocs_signature_cloud import *
import groupdocs_signature_cloud

client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from
client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from

api = groupdocs_signature_cloud.SignApi.from_keys(client_id, client_secret)

fileInfo = FileInfo()
fileInfo.file_path = "signaturedocs\\one-page.docx"

opts = SignDigitalOptions()
opts.signature_type = 'Digital'
opts.image_file_path = "signaturedocs\\signature.jpg"
opts.certificate_file_path = "signaturedocs\\temp.pfx"
opts.password = '1234567890'

# set signature position on a page
opts.left = 100 = 100
opts.width = 200
opts.height = 100
opts.location_measure_type = "Pixels"
opts.size_measure_type = "Pixels"
opts.rotation_angle = 0
opts.horizontal_alignment = "None"
opts.vertical_alignment = "None"
opts.margin = Padding()
opts.margin.all = 5
opts.margin_measure_type = "Pixels" = 1

settings = SignSettings()
settings.options = [opts]
settings.save_options = SaveOptions()
settings.save_options.output_file_path = "signaturedocs\\signedDigitalOne_page.docx"
settings.file_info = fileInfo

request = CreateSignaturesRequest(settings)
response = api.create_signatures(request)

# For complete examples and data files, please go to
require 'groupdocs_signature_cloud'

$client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from
$client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from

api = GroupDocsSignatureCloud::SignApi.from_keys($client_id, $client_secret)

$info =
$info.file_path = "signaturedocs\\one-page.docx"

$opts =
$opts.signature_type = 'Digital'
$opts.image_file_path = "signaturedocs\\signature.jpg"
$opts.certificate_file_path = "signaturedocs\\temp.pfx"
$opts.password = '1234567890'

$settings =
$settings.options = [$opts]

$settings.save_options =
$settings.save_options.output_file_path = "signaturedocs\\signedDigitalOne_page.docx"
$settings.file_info = $info

$request =$settings)

# Executing an API.
$response = api.create_signatures($request)