Digital Certificate, known as identity certificate, is an electronic document that uses a digital signature to bind together a public key with an identity. As long as the PDF digital certificate is created, it demonstrates the authority of a digital document. This section will introduce a solution to create PDF digital certificate for WPF via a WPF PDF component.
Spire.PDF for WPF , a WPF library which can fully control your PDF documents, enables you to create PDF digital certificate in a simple way. First, please see the effect of this digital certificate task as below picture:
Before viewing the code, please Download Spire.PDF for WPF and install it in system.
In this solution, first you need to load your .pfx file from system. Then, create a new instance of Spire.Pdf.Security.PdfCertificate class with two parameters passed, one is the certificate file and the other is the password of the imported .pfx file. After creating a PdfSignature class instance, you can add DocumentPermissions to be AllowComments, AllowFormFill and ForbidChanges.
When you create the PdfSignature class instance, there are four parameters. The parameter "page" enables you to choose which PDF page you decide to sign the digital certificate.
String pfxPath = @"..\Data\Demo.pfx"; PdfCertificate cert = new PdfCertificate(pfxPath, "e-iceblue"); PdfSignature signature = new PdfSignature(doc, page, cert, "demo"); signature.ContactInfo = "Harry Hu"; signature.Certificated = true; signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill;
Dim pfxPath As String = "..\Data\Demo.pfx" Dim cert As New PdfCertificate(pfxPath, "e-iceblue") Dim signature As New PdfSignature(doc, page, cert, "demo") signature.ContactInfo = "Harry Hu" signature.Certificated = True signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill
Spire.PDF for WPF enables your WPF applications to read, write and manipulate PDF documents without using Adobe Acrobat or any third party component library, click to know more about this WPF PDF component.