How to Create Digital Certificate in PDF – C#/Vb.NET

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.

  1. 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.
  2. 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.
  3. Save and launch file.

Main Coding:


using System;

using Spire.Pdf;

using Spire.Pdf.Security;

namespace DigitalCertificate


    class Certificate


        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”);

            PdfSignature signature = new PdfSignature(doc, page, cert, “Certificate”);

            signature.ContactInfo = “JaneWDasiy”;

            signature.Certificated = true;

            signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill;

            //Save and Launch








Imports System

Imports Spire.Pdf

Imports Spire.Pdf.Security

Namespace DigitalCertificate

       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”)

                     signature.ContactInfo = “JaneWDasiy”

                     signature.Certificated = True

                     signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill

                     ‘Save and Launch




              End Sub

       End Class

End Namespace

Result Shown by Following:


Click Here to Learn more about Spire.PDF

Click Here to Download Spire.PDF


One thought on “How to Create Digital Certificate in PDF – C#/Vb.NET

  1. Mark Cruz says:

    In building a website, it is not enough to just consider a reliable web hosting provider, useful tools, and web programming codes. One of the most important factors to consider in building a good website is the design. The design is a very critical aspect for the success of a business or blog website. In addition, especially if your website is running a business or includes financial transactions, it is necessary to put digital certificates for the assurance of the visitors or customers. Thank you for sharing this useful article about the importance of considering the web design of a website and keep it up!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s