在IronPDF中應用數位簽章
數位簽章是一種密碼學方法,可以使用IronPDF程式庫新增到現有的PDF文件中。 這包括新增單一和多重簽章與漸進式儲存簽章。
支援的數位簽章憑證
IronPDF支援Windows格式的.p12數位簽章憑證。 這些憑證符合X509Certificate2標準。 您可以通過檢查數位簽章憑證的檔案擴展名來驗證其格式。
如果您沒有所需格式的憑證,請參照此文件來建立新的X509Certificate2標準憑證。 然後可以通過IronPDF將生成的憑證應用於PDF文件。
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))
確保專案中的影像文件屬性設置為"CopyToOutputDirectory=always",以便在簽章應用後,影像可以在PDF文件中被找到並渲染。
若要了解更多關於如何透過IronPDF應用數位簽章,請參閱給PDF文件數位簽章。
如需工程支援,請參見如何為IronPDF提出工程支援請求。

