在 IronPDF 中應用數位簽名
數位簽章是一種加密方法,可以使用 IronPDF 庫將其新增至現有的 PDF 文件中。 這包括添加單一和多個簽名,以及增量節省簽名。
支援的數位簽章證書
IronPDF 支援 Windows 系統的.pfx格式數位簽章憑證和 MacOS 系統的.p12格式數位簽章憑證。 這些產品符合X509Certificate2標準。 您可以透過檢查檔案副檔名來驗證現有數位簽章憑證的格式。
如果您沒有所需格式的證書,請參考此文件建立新的X509Certificate2標準證書。 然後可以使用 IronPDF 將產生的憑證套用到 PDF 文件中。
X509KeyStorageFlags.Exportable 。 某些證書的KeyStorageFlags預設為 Exportable。 嘗試使用不同的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));確保專案中的影像檔案屬性設定為"CopyToOutputDirectory=always" ,以便在套用簽署後能夠在 PDF 文件中找到並渲染該影像。
要了解有關透過 IronPDF 應用數位簽章的更多信息,請查看"對 PDF 文件進行數位簽章" 。
如需工程支持,請參閱如何為 IronPDF 提出工程支持請求。






