在 IronPDF 中應用數位簽章

This article was translated from English: Does it need improvement?
Translated
View the article in English

數位簽章是一種加密方法,可透過 IronPDF 函式庫添加至現有的 PDF 文件中。 這包括新增單一多重簽名,並搭配遞增節省簽名。

支援的數位簽章憑證

IronPDF 支援 Windows 系統的 .pfx 格式數位簽章憑證,以及 macOS 系統的 .p12 格式數位簽章憑證。 這些內容符合 X509Certificate2 標準。 您可以透過檢查檔案副檔名來驗證現有數位簽章憑證的格式。

若您沒有符合要求的憑證,請參閱此文件以建立新的 X509Certificate2 標準憑證。 生成的憑證隨後可透過 IronPDF 套用至 PDF 文件中。

請注意IronPDF 僅支援 X509KeyStorageFlags.Exportable。 部分憑證預設將 KeyStorageFlags 設定為"可匯出"。 若嘗試使用不同的 KeyStorageFlags,將會引發例外狀況。)}]

附圖簽名

可在 PDF 文件中加入圖片,以視覺方式標示該文件已進行數位簽章。 可透過 IronPDF 並使用以下程式碼片段來實現:

// Create a PdfSignature object by specifying the certificate file (.pfx) and its password
var sig = new PdfSignature("IronSoftware.pfx", "123456");

// Set the signature image which includes the image path, page number, and its position in the document
sig.SignatureImage = new PdfSignatureImage("IronSoftware.png", 0, new Rectangle(0, 600, 100, 100));
// Create a PdfSignature object by specifying the certificate file (.pfx) and its password
var sig = new PdfSignature("IronSoftware.pfx", "123456");

// Set the signature image which includes the image path, page number, and its position in the document
sig.SignatureImage = new PdfSignatureImage("IronSoftware.png", 0, new Rectangle(0, 600, 100, 100));
' Create a PdfSignature object by specifying the certificate file (.pfx) and its password
Dim sig = New PdfSignature("IronSoftware.pfx", "123456")

' Set the signature image which includes the image path, page number, and its position in the document
sig.SignatureImage = New PdfSignatureImage("IronSoftware.png", 0, New Rectangle(0, 600, 100, 100))
$vbLabelText   $csharpLabel

請確保專案中的圖片檔案屬性已設定為 "CopyToOutputDirectory=always",以便在套用簽名後,系統能於 PDF 文件中找到並渲染該圖片。

若要進一步了解如何透過 IronPDF 套用數位簽章,請參閱《對 PDF 文件進行數位簽章》。

如需工程支援,請參閱《如何提交 IronPDF 工程支援請求》

Curtis Chau
技術撰稿人

Curtis Chau 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

除了開發工作之外,Curtis 對物聯網(IoT)抱有濃厚興趣,致力於探索整合硬體與軟體的創新方法。閒暇時,他喜歡玩遊戲和開發 Discord 機器人,將對科技的熱愛與創意相結合。

準備開始了嗎?
Nuget 下載 19,014,616 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 轉為 PDF。