In order to verify our own identify or distinguish others’ identify online, Certificate Authority published digital certificate, which includes a public key, information key owner. Digital certificate plays a very important role when delivering information online. It can protect security of personal account, password and other important information when we trade with others online. In this post, I will show the method about how to create digital certificate in a PDF document with C# and VB.NET.
In my example, I prepare a certificate, which is not an official certificate but a simple one for example.
Now, let’s follow the steps to create PDF digital certificate.
At the beginning, I add Spire.PDF dll file as reference because I will use this third-party component in my method.
- Create a PDF document and add one page. Because I just want to show an example, so I don’t draw any contents on this blank page.
- Create certificate and signature. Firstly. declare a string pfxPath and assign certificate as value to it. Secondly.
create certificate. It should include two parameters, pfxPath and a password. Thirdly. add signature. There are four parameters, PDF document, page, certificate and signature name. Finally. set other information, including contact information, document permission.
- Save and launch file.
static void Main( string  args)
//Create Document and Add Page
PdfNewDocument doc = new PdfNewDocument ();
PdfPageBase page = doc.Pages.Add();
//Create Certificate and Signature
String pfxPath = @”D:\work\My Documents\Certificate.pfx” ;
PdfCertificate cert = new PdfCertificate (pfxPath, “e-iceblue” );
Friend Class Certificate
Shared Sub Main( ByVal args() As String )
‘Create Document and Add Page
Dim doc As New PdfNewDocument()
Dim page As PdfPageBase = doc.Pages.Add()
‘Create Certificate and Signature
Dim pfxPath As String = “D:\work\My Documents\Certificate.pfx”
Dim cert As New PdfCertificate(pfxPath, “e-iceblue” )
Dim signature As New PdfSignature(doc, page, cert, “Certificate” )