在 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 提交工程支持请求。






