IRONSOFTWAREHOME
数字签名
using IronPdf;
using IronPdf.Signing;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// Step 1. Create a PDF
var renderer = new ChromePdfRenderer();
var doc = renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");

// Step 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
// Read: https://helpx.adobe.com/acrobat/using/digital-ids.html

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456")
{
    // Step 3. Optional signing options and a handwritten signature graphic
    SigningContact = "support@ironsoftware.com",
    SigningLocation = "Chicago, USA",
    SigningReason = "To show how to sign a PDF"
};

//Step 3. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.Sign(signature);

//Step 4. The PDF is not signed until saved to file, steam or byte array.
doc.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing

' Cryptographically sign an existing PDF in 1 line of code!
Call (New IronPdf.Signing.PdfSignature("Iron.p12", "123456")).SignPdfFile("any.pdf")

'/***** Advanced example for more control *****/

' Step 1. Create a PDF
Dim renderer = New ChromePdfRenderer()
Dim doc = renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>")

' Step 2. Create a Signature.
' You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
' Read: https://helpx.adobe.com/acrobat/using/digital-ids.html

Dim signature = New IronPdf.Signing.PdfSignature("Iron.pfx", "123456") With {
    ' Step 3. Optional signing options and a handwritten signature graphic
    .SigningContact = "support@ironsoftware.com",
    .SigningLocation = "Chicago, USA",
    .SigningReason = "To show how to sign a PDF"
}

'Step 3. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.Sign(signature)

'Step 4. The PDF is not signed until saved to file, steam or byte array.
doc.SaveAs("signed.pdf")
NuGet Download
PM > Install-Package IronPdf
数字签名

数字签名

数字签名PDF文档有助于确保文档的完整性,提供一种向PDF本身添加身份验证的方法。 使用IronPDF,您对签署新的或现有的PDF文件有多种选择。这些包括用证书来数字签名PDF文档,向PDF添加图形式手写签名版本,在PDF上盖上证书的图像,或者干脆在PDF上创建一个签名表单字段以提示用户签名。

使用IronPDF进行PDF数字签名的步骤

此过程的第一步是加载或创建我们要签名的PDF。 在此示例中,我们创建一个新的ChromePdfRenderer实例。 这是IronPDF强大的渲染引擎,用于渲染HTML、CSS和JavaScript为PDF而不损失质量。 然后我们使用RenderHtmlAsPdf方法将我们的HTML字符串渲染成一份高质量的PDF文档,以便签署。 生成的PDF存储在doc变量中。

接下来,我们需要创建我们的签名。 在此示例中,我们使用证书对PDF文档进行签名。 SigningReason提供签署文件的原因。

接下来,我们使用创建的PdfSignature对象签署PDF文档。 通过调用Sign方法,我们可以在一行中轻松地将签名应用到PDF文档中。此方法可以为PDF文档应用多个签名证书。

最后,我们使用SaveAs方法保存签署的PDF文档,该方法将PDF保存到指定的文件位置。

了解如何使用 IronPDF 安全地签署 PDF。
在 GitHub 上查看

准备开始了吗?

Nuget Downloads 21,105,021版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥。

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

OR
bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥。
无需信用卡或创建账户
C# 用于 PDF 的 NuGet 库
通过 NuGet 安装

版本: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. 在解决方案资源管理器中,右键点击引用,管理 NuGet 包
  2. 选择浏览并搜索 “IronPDF”
  3. 选择包并安装
C# PDF DLL
下载 DLL

版本: 2026.9

或在此处下载 Windows 安装程序。

  1. 下载并解压 IronPDF 到您的解决方案目录中的 ~/Libs 之类的位置
  2. 在 Visual Studio 解决方案资源管理器中,右键点击引用。选择浏览,“IronPDF.dll”

$999 起