文档彩票走势图>>E-iceblue中文文档>>使用时间戳服务器对 PDF 进行数字签名
使用时间戳服务器对 PDF 进行数字签名
Spire.PDF for .NET 是一款专门对 Word 文档进行操作的 .NET 类库。致力于在于帮助开发人员轻松快捷高效地创建、编辑、转换和打印 Microsoft Word 文档,而无需安装 Microsoft Word。
行号用于在每行文本旁边显示 Word 自动计算的行数。当我们需要参考合同或法律文件等文档中的特定行时,它非常有用。word中的行号功能允许我们设置起始值、编号间隔、与文本的距离以及行号的编号方式。使用 Spire.Doc,我们可以实现上述所有功能。本文将介绍如何将 HTML 转换为 PDF。
欢迎加入spire技术交流群:767755948
数字时间戳用时间和日期标记 PDF 签名,以证明其完整性。时间戳表明文档内容存在于某个时间点,且未发生变化。本文将介绍如何使用 Spire.PDF 对带有时间戳服务器的 PDF 文档进行数字签名。
代码片段:
[C#]
using Spire.Pdf; using Spire.Pdf.Graphics; using Spire.Pdf.Security; using System.Drawing; namespace SignPDFwithTimestamp { class Program { static void Main(string[] args) { //create a PdfDocument object and load a PDF file PdfDocument doc = new PdfDocument(); doc.LoadFromFile(@"C:\Users\Administrator\Desktop\Example.pdf"); //load the certificate .pfx file PdfCertificate cert = new PdfCertificate(@"C:\Users\Administrator\Desktop\gary.pfx", "e-iceblue"); //add a signature to the specified position PdfSignature signature = new PdfSignature(doc, doc.Pages[0], cert, "signature"); signature.Bounds = new RectangleF(new PointF(350, 700), new SizeF(180, 90)); //set the signature content signature.NameLabel = "Digitally signed by:Gary"; signature.LocationInfoLabel = "Location:"; signature.LocationInfo = "CN"; signature.ReasonLabel = "Reason: "; signature.Reason = "Ensure authenticity"; signature.ContactInfoLabel = "Contact Number: "; signature.ContactInfo = "028-81705109"; signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.ForbidChanges; signature.GraphicsMode = GraphicMode.SignImageAndSignDetail; signature.SignImageSource = PdfImage.FromFile(@"C:\Users\Administrator\Desktop\company-logo.jpg"); //configure a timestamp server string url = "//timestamp.wosign.com/rfc3161"; signature.ConfigureTimestamp(url); //save to file doc.SaveToFile("output.pdf"); } } }[VB.NET]
Imports Spire.Pdf Imports Spire.Pdf.Graphics Imports Spire.Pdf.Security Imports System.Drawing Namespace SignPDFwithTimestamp Class Program Private Shared Sub Main(args As String()) 'create a PdfDocument object and load a PDF file Dim doc As PdfDocument = New PdfDocument() doc.LoadFromFile("C:\Users\Administrator\Desktop\Example.pdf") 'load the certificate .pfx file Dim cert As PdfCertificate = New PdfCertificate("C:\Users\Administrator\Desktop\gary.pfx","e-iceblue") 'add a signature to the specified position Dim signature As PdfSignature = New PdfSignature(doc,doc.Pages(0),cert,"signature") signature.Bounds = New RectangleF(New PointF(350, 700), New SizeF(180, 90)) 'set the signature content signature.NameLabel = "Digitally signed by:Gary" signature.LocationInfoLabel = "Location:" signature.LocationInfo = "CN" signature.ReasonLabel = "Reason: " signature.Reason = "Ensure authenticity" signature.ContactInfoLabel = "Contact Number: " signature.ContactInfo = "028-81705109" signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.ForbidChanges signature.GraphicsMode = GraphicMode.SignImageAndSignDetail signature.SignImageSource = PdfImage.FromFile("C:\Users\Administrator\Desktop\company-logo.jpg") 'configure a timestamp server Dim url As String = "//timestamp.wosign.com/rfc3161" signature.ConfigureTimestamp(url) 'save to file doc.SaveToFile("output.pdf") End Sub End Class End Namespace
输出: