今天,GroupDocs 宣布首次公开发布下一代 GroupDocs.Signature Cloud 17.12。它是一个电子签名 REST API,可在您的应用程序中添加电子签名的功能,而无需安装任何其他软件。 GroupDocs.Signature Cloud API 是一种为您的应用程序提供电子签名功能的简单方法,具有添加电子签名验证签名和搜索等功能支持的文件格式 中的签名以及其他功能。请查看 发行说明 以获取 GroupDocs.Signature Cloud 第一个版本中提供的功能的完整列表。以下部分描述了有关这些功能的一些详细信息。

支持的签名类型

GroupDocs.Signature Cloud 的第一个版本在 API 中支持以下类型的签名:

  • 电子签名
  • 条码签名
  • 二维码签名
  • 文字签名
  • 图像签名

向文档添加数字签名

GroupDocs.Signature Cloud REST API 支持向文档添加数字签名。它提供了通过使用请求正文中的签名选项对象数据在文档页面中创建数字签名的方法,其中包含不同的证书类型、位置、对齐方式、字体、边距和外观选项。为此,请参阅以下 URI、REST 命令 (Curl) 和 .NET SDK 示例。统一资源标识符

https://api.groupdocs.cloud/v1/signature/{filename}/digital

请求数据

{"Visible": true,"Password": "password","CertificateGuid": "temp.pfx","ImageGuid": "signature.jpg","Left": 10,"Top": 10,"Width": 40,"Height": 10,"LocationMeasureType": "Millimeters","SizeMeasureType": "Millimeters","RotationAngle": 0,"HorizontalAlignment": "Right","VerticalAlignment": "Bottom","Margin": {"All": 10,"Left": 10,"Top": 10,"Right": 10,"Bottom": 10},"MarginMeasureType": "Millimeters","Opacity": 0.5,"SignAllPages": true,"DocumentPageNumber": 1,"OptionsType": "PdfSignDigitalOptionsData"} 

其余示例(cURL)

curl -v "https://api.groupdocs.cloud/v1/signature/01_pages.pdf/digital" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "{"Visible": true,"Password": "password","CertificateGuid": "temp.pfx","ImageGuid": "signature.jpg","Left": 10,"Top": 10,"Width": 40,"Height": 10,"LocationMeasureType": "Millimeters","SizeMeasureType": "Millimeters","RotationAngle": 0,"HorizontalAlignment": "Right","VerticalAlignment": "Bottom","Margin": {"All": 10,"Left": 10,"Top": 10,"Right": 10,"Bottom": 10},"MarginMeasureType": "Millimeters","Opacity": 0.5,"SignAllPages": true,"DocumentPageNumber": 1,"OptionsType": "PdfSignDigitalOptionsData"}" \
-H "authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” 

.NET SDK 示例

//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
var configuration = new Configuration
{
    AppSid = Sid,
    AppKey = Key
};

var apiInstance = new SignatureApi(configuration);

try
{
    var signOptionsData = new GroupDocs.Signature.Cloud.Sdk.Model.PdfSignDigitalOptionsData()
    {
        DocumentPageNumber = 1,
        Height = 80,
        HorizontalAlignment = GroupDocs.Signature.Cloud.Sdk.Model.SignDigitalOptionsData.HorizontalAlignmentEnum.Right,
        Left = 10,
        LocationMeasureType = GroupDocs.Signature.Cloud.Sdk.Model.SignDigitalOptionsData.LocationMeasureTypeEnum.Pixels,
        Margin = new GroupDocs.Signature.Cloud.Sdk.Model.PaddingData() { Left = 10, Right = 10, Bottom = 10, Top = 10 },
        MarginMeasureType = GroupDocs.Signature.Cloud.Sdk.Model.SignDigitalOptionsData.MarginMeasureTypeEnum.Pixels,
        Opacity = 0.5,
        SignAllPages = false,
        CertificateGuid = "temp.pfx",
        Password="password",
        ImageGuid="signature.jpg",
        Top = 100,
        VerticalAlignment = GroupDocs.Signature.Cloud.Sdk.Model.SignDigitalOptionsData.VerticalAlignmentEnum.Center,
        Width = 100
    };
    var request = new PostDigitalRequest
    {
        Name = "02_pages.pdf",
        SignOptionsData = signOptionsData,
        Password = null,
        Folder = null,

    };

    var response = apiInstance.PostDigital(request);

    Debug.Print("FleName: " + response.FileName);

}
catch (Exception e)
{
    Debug.Print("Exception when signing document with digital signature: " + e.Message);
} 

验证数字签名

GroupDocs.Signature Cloud REST API 支持验证签名文档。它提供了通过使用请求正文中的验证选项对象数据来验证文档页面中的数字签名的方法,其中包含页码、文本和搜索条件的不同选项。为此,请参阅以下 URI、JSON 请求数据、REST 命令(Curl)和 .NET SDK 示例。统一资源标识符

https://api-qa.groupdocs.cloud/v1/signature/{filename}/digital/verification?Folder={folder} 

请求数据

"{"DocumentPageNumber":1,"Password": "password","CertificateGuid": "temp.pfx","Comments": "verified data","SignDateTimeFrom": "1/12/2017","SignDateTimeTo":"12/12/2017","OptionsType":"PdfVerifyDigitalOptionsData"} 

其余示例(cURL)

curl -v "[https://api-qa.groupdocs.cloud/v1/signature/Signed_Digital.pdf/digital/verification?Folder=signed"][7] \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "{"DocumentPageNumber":1,"Password": "password","CertificateGuid": "temp.pfx","Comments": "verified data","SignDateTimeFrom": "1/12/2017","SignDateTimeTo":"12/12/2017","OptionsType":"PdfVerifyDigitalOptionsData"}" \
-H "authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” 

.NET SDK 示例

//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
var configuration = new Configuration
{
    AppSid = Sid,
    AppKey = Key
};
var apiInstance = new SignatureApi(configuration);
try
{
    var verifyOptionsData = new GroupDocs.Signature.Cloud.Sdk.Model.PdfVerifyDigitalOptionsData()
    {
        DocumentPageNumber= 1,
        Password = "password",
        CertificateGuid = "temp.pfx",
    };
    var request = new PostVerificationDigitalRequest
    {
        Name = "Signed_Digital.pdf",
        VerifyOptionsData = verifyOptionsData,
        Password = null,
        Folder = "signed"
    };
var response = apiInstance.PostVerificationDigital(request);
Debug.Print("FleName: " + response.FileName);
Debug.Print("Result: " + response.Result);
}
catch (Exception e)
{
Debug.Print("Exception when verifying Digital signature: " + e.Message);
} 

API浏览器

GroupDocs for Cloud REST API 附带一个基于 Web 的 API Explorer,它提供了一种最简单的方法来立即在您最喜欢的浏览器中试用我们的 API。它是 Cloud API GroupDocs 的 Swagger 文档集合。简而言之,首先您需要使用 GroupDocs for Cloud 注册获取 APP 密钥和 SID 并开始在 Web 浏览器中以交互方式测试 GropuDocs.Signature Cloud Rest API

GroupDocs.Signature 云资源

以下是完成任务可能需要的一些有用资源的链接。

立即开始免费试用

立即开始免费试用 – 您只需注册 GroupDocs 云服务。注册后,您就可以尝试 GroupDocs Cloud 提供的强大文件处理功能。