HTML JPG PDF XML DOCX
  Product Family
PDF

在 .NET SDK 中从 PDF 获取签名

使用服务器端 .NET API 从 PDF 文档中获取签名的 API。

Get Started

如何使用 Cloud .NET SDK 从 PDF 文档中提取签名

为了通过 Cloud .NET SDK 从 PDF 文档中获取签名,我们将使用 Aspose.PDF Cloud .NET SDK 这个 Cloud SDK 允许您在 C#、ASP.NET 或其他 .NET 语言中轻松构建基于云的 PDF 创建、编辑和转换应用程序。打开 NuGet 包管理器,搜索 Aspose.PDF Cloud 并安装。您还可以使用以下命令从包管理器控制台安装。

包管理器控制台命令


     
    PM> Install-Package Aspose.Pdf-Cloud
     
     

使用 .NET SDK 获取签名的步骤

Aspose.PDF Cloud 开发人员可以轻松地从 PDF 文档中提取签名。开发人员只需要几行代码。

  1. 使用您的应用程序密钥和密钥创建一个新的 Configuration 对象
  2. 创建一个对象以连接到云 API
  3. 上传您的文档文件
  4. 使用 GetDocumentSignatureFieldsAsync 函数从云存储中的 PDF 文档中提取签名
  5. 检查响应并记录结果
  6. 如果操作成功,打印签名列表
 

此示例代码显示从 PDF 文档中获取签名


using Aspose.Pdf.Cloud.Sdk.Model;

namespace Signatures
{
    public class GetSignatures
    {
        public static async Task Extract(string documentName, string remoteFolder)
        {
		// Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required). 
		pdfApi = new PdfApi(AppSecret, AppSid);

                using (var file = File.OpenRead(Path.Combine(localFolder, documentName)))
		{ // Upload the local PDF to cloud storage folder name.
                    FilesUploadResult uploadResponse = await pdfApi.UploadFileAsync(Path.Combine(remoteFolder, documentName), documentName);
                    Console.WriteLine(uploadResponse.Uploaded[0]);
                }

                // Get signatures from the PDF in cloud storage.
                SignatureFieldsResponse response = await pdfApi.GetDocumentSignatureFieldsAsync(documentName, folder: remoteFolder);

                // Checks the response and logs the result.
                if (response == null)
                    Console.WriteLine("GetSignatures(): Unexpected error!");
                else if (response.Code < 200 || response.Code > 299)
                    Console.WriteLine("GetSignatures(): Failed to receive signatures from the document.");
                else if (response.Fields == null ||  response.Fields.List == null ||  response.Fields.List.Count == 0)
                    Console.WriteLine("GetSignatures(): signatures not found in the document.");
                else
                { // Show signatures.
                    Console.WriteLine("GetSignatures(): Signatures extracted successfully from the Pdf document '{0}'.", documentName);
                    foreach (var field in response.Fields.List) {
                        Console.WriteLine(field);
                    }
                }
            }
        }
    }
 

通过 .NET SDK 在 PDF 中处理签名

签名提取允许系统地检查文档的有效性和相关性,签名的日期和时间以及文档的完整性。诸如文档签名提取或组分析等任务提供自动化,节省时间并减少人工工作量。 使用 Aspose.PDF Cloud .NET SDK 从 PDF 文档中提取签名。

使用我们的 .NET SDK,您可以

  • 以文本或图像格式添加 PDF 文档的页眉和页脚。
  • 向 PDF 文档添加表格和文本或图像戳记。
  • 将多个 PDF 文档附加到现有文件。
  • 处理 PDF 附件、注释和表单字段。
  • 对 PDF 文档进行加密或解密并设置密码。
  • 从页面或整个 PDF 文档中删除所有戳记和表格。
  • 根据 ID 从 PDF 文档中删除特定的戳记或表格。
  • 替换 PDF 页面上的单个或多个文本实例或整个文档中的文本。
  • 提供将 PDF 文档转换为多种其他文件格式的广泛支持。
  • 提取 PDF 文件的各种元素并优化 PDF 文档。
  • 您可以尝试我们的免费应用程序来测试功能。

  •