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
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 20,389,208版本:2026.7剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰

bullet_checked無需信用卡或建立帳號
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
預訂您的免費現場演示
Booking Badge related to IronPDF Product Demo

受到全球數百萬工程師的信任

Iron Software的客戶標誌
獲取您的無義務諮詢
填寫以下表格或電子郵件sales@ironsoftware.com
您的詳細資訊將始終保密
受到全球數百萬工程師的信任
Iron Software的客戶標誌
立即獲取您的30天試用金鑰
無需信用卡或帳戶建立