menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfCertificate - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfCertificate

    Represents the Certificate object.

    Inheritance
    System.Object
    PdfCertificate
    Namespace: Syncfusion.Pdf.Security
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public class PdfCertificate : Object
    Remarks

    This API is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    // Creates a new document
    PdfDocument doc = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = doc.Pages.Add();
    //Create new PDF certificate instance.
    PdfCertificate pdfCert = new PdfCertificate("Pdf.pfx", "syncfusion");
    //Create new PDF signature instance.
    PdfSignature signature = new PdfSignature(doc, page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5),new SizeF(100,200));            
    doc.Save("SignedPdfSample.pdf");
    doc.Close(true);
    ' Creates a new document
    Dim doc As PdfDocument = New PdfDocument()
    ' Create a page
    Dim page As PdfPage = doc.Pages.Add()
    'Create new PDF certificate instance.
    Dim pdfCert As PdfCertificate = New PdfCertificate("Pdf.pfx", "syncfusion")
    'Create new PDF signature instance.
    Dim signature As PdfSignature = New PdfSignature(doc, page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5),New SizeF(100,200))
    doc.Save("SignedPdfSample.pdf")
    doc.Close(True)

    Constructors

    PdfCertificate(Stream, String)

    Initializes a new instance of the PdfCertificate class with the path to the pfx file and the password.

    Declaration
    public PdfCertificate(Stream certificate, string password)
    Parameters
    Type Name Description
    System.IO.Stream certificate
    System.String password

    The password for pfx file.

    Remarks

    This constructor is not supported in WinRT and Silverlight.

    Examples
    // Creates a new document
    PdfDocument doc = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = doc.Pages.Add();
    PdfCertificate pdfCert = new PdfCertificate(certificateStream, "123");
    PdfSignature signature = new PdfSignature(doc, page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5),new SizeF(100,200));            
    doc.Save("SignedPdfSample.pdf");
    doc.Close(true);
    ' Creates a new document
    Dim doc As PdfDocument = New PdfDocument()
    ' Create a page
    Dim page As PdfPage = doc.Pages.Add()
    Dim pdfCert As PdfCertificate = New PdfCertificate(certificateStream, "123")
    Dim signature As PdfSignature = New PdfSignature(doc, page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5),New SizeF(100,200))
    doc.Save("SignedPdfSample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfFont

    PdfCertificate(Stream, String, KeyStorageFlags)

    Initializes a new instance of the PdfCertificate class with the path to the pfx file,password and storageflag

    Declaration
    public PdfCertificate(Stream certificate, string password, KeyStorageFlags storageFlag)
    Parameters
    Type Name Description
    System.IO.Stream certificate
    System.String password

    The password for pfx file.

    KeyStorageFlags storageFlag

    The private key storage flag.

    Remarks

    This constructor is not supported in WinRT and Silverlight.

    Examples
    // Creates a new document
    PdfDocument doc = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = doc.Pages.Add();
    PdfCertificate pdfCert = new PdfCertificate(certificateStream, "123",KeyStorageFlags.DefaultKeySet);
    PdfSignature signature = new PdfSignature(doc, page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5),new SizeF(100,200));            
    doc.Save("SignedPdfSample.pdf");
    doc.Close(true);
    ' Creates a new document
    Dim doc As PdfDocument = New PdfDocument()
    ' Create a page
    Dim page As PdfPage = doc.Pages.Add()
    Dim pdfCert As PdfCertificate = New PdfCertificate(certificateStream, "123",KeyStorageFlags.DefaultKeySet)
    Dim signature As PdfSignature = New PdfSignature(doc, page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5),New SizeF(100,200))
    doc.Save("SignedPdfSample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfFont

    PdfCertificate(X509Certificate2)

    Initialize the new instance of the PdfCertificate class.

    Declaration
    public PdfCertificate(X509Certificate2 x509Certificate2)
    Parameters
    Type Name Description
    System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate2

    The X509 certificate.

    Examples
    // Creates a new document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    //Load the x509 certificate.
    X509Certificate2 cert = new X509Certificate2("certificate.pfx", "password");
    //Create a new PDF certificate instance using X509Certificate2 object.
    PdfCertificate pdfCert = new PdfCertificate(cert);
    //Creates a signature.
    PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(100, 100));
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    //Save the document.
    document.Save("output.pdf");
    //Close the document.
    document.Close(true);
    ' Creates a new document
    Dim document As New PdfDocument()
    'Creates a new page and adds it as the last page of the document
    Dim page As PdfPage = document.Pages.Add()
    'Load the x509 certificate.
    Dim cert As New X509Certificate2("certificate.pfx", "password")
    'Create a new PDF certificate instance using X509Certificate2 object.
    Dim pdfCert As New PdfCertificate(cert)
    'Creates a signature.
    Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(0, 0), New SizeF(100, 100))
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    'Save the document.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Properties

    IssuerName

    Gets the certificate issuer's name.[Read-Only]

    Declaration
    public string IssuerName { get; }
    Property Value
    Type Description
    System.String

    The certificate issuer`s name.

    Remarks

    This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    PdfDocument doc = new PdfDocument();
    PdfPage page = doc.Pages.Add();
    PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
    PdfPen pen = new PdfPen(brush, 0.2f);
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular);
    PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
    PdfSignature signature = new PdfSignature(page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5), page.Size);
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    PdfGraphics g = signature.Appearence.Normal.Graphics;
    string validto  = "Issuer Name: " + signature.Certificate.IssuerName.ToString()
    string validfrom = "Valid From: " + signature.Certificate.ValidFrom.ToString();
    doc.Pages[0].Graphics.DrawString(validfrom, font, pen, brush, 0, 90);
    doc.Pages[0].Graphics.DrawString(validto, font, pen, brush, 0, 110);
    doc.Pages[0].Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130);
    doc.Pages[0].Graphics.DrawString("* To validate Signature click on the signature on this page \n * To check Document Status \n click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150);
    // Save the PDF file.
    doc.Save("Sample.pdf");
    doc.Close(true);
    Dim doc As PdfDocument = New PdfDocument()
    Dim page As PdfPage = doc.Pages.Add()
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Black)
    Dim pen As PdfPen = New PdfPen(brush, 0.2f)
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular)
    Dim pdfCert As PdfCertificate = New PdfCertificate("PDF.pfx", "syncfusion")
    Dim signature As PdfSignature = New PdfSignature(page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5), page.Size)
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    Dim g As PdfGraphics = signature.Appearence.Normal.Graphics
    Dim validto As String = "Issuer Name: " + signature.Certificate.IssuerName.ToString()
    Dim validfrom As String = "Valid From: " + signature.Certificate.ValidFrom.ToString()
    doc.Pages(0).Graphics.DrawString(validfrom, font, pen, brush, 0, 90)
    doc.Pages(0).Graphics.DrawString(validto, font, pen, brush, 0, 110)
    ' Save the PDF file.
    doc.Save("Sample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfFont

    SerialNumber

    Gets the serial number of a certificate.[Read-Only]

    Declaration
    public byte[] SerialNumber { get; }
    Property Value
    Type Description
    System.Byte[]

    The serial number of the certificate.

    Remarks

    This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    // Creates a new document
    PdfDocument document = new PdfDocument();
    //Creates a new page and adds it as the last page of the document
    PdfPage page = document.Pages.Add();
    //Load an existing PDF certificate.
    PdfCertificate certificate = new PdfCertificate("certificate.Pfx", "password");
    //Get the serial number of the certificate.
    byte[] data = certificate.SerialNumber;
    //Get the store certificate.
    PdfCertificate storeCertificate = PdfCertificate.FindBySerialId(StoreType.MY, data);
    //Creates a digital signature.
    PdfSignature signature = new PdfSignature(document, page, storeCertificate, "Signature");
    signature.Bounds = new RectangleF(new PointF(0, 0), new SizeF(100, 100));
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    //Save the document.
    document.Save("output.pdf");
    //Close the document.
    document.Close(true);
    ' Creates a new document
    Dim document As New PdfDocument()
    'Creates a new page and adds it as the last page of the document
    Dim page As PdfPage = document.Pages.Add()
    'Load an existing PDF certificate.
    Dim certificate As New PdfCertificate("certificate.Pfx", "password")
    'Get the serial number of the certificate.
    Dim data As Byte() = certificate.SerialNumber
    'Get the store certificate.
    Dim storeCertificate As PdfCertificate = PdfCertificate.FindBySerialId(StoreType.MY, data)
    'Creates a digital signature.
    Dim signature As New PdfSignature(document, page, storeCertificate, "Signature")
    signature.Bounds = New RectangleF(New PointF(0, 0), New SizeF(100, 100))
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    'Save the document.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    SubjectName

    Gets the certificate subject's name.[Read-Only]

    Declaration
    public string SubjectName { get; }
    Property Value
    Type
    System.String
    Remarks

    This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    PdfDocument doc = new PdfDocument();
    PdfPage page = doc.Pages.Add();
    PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
    PdfPen pen = new PdfPen(brush, 0.2f);
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular);
    PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
    PdfSignature signature = new PdfSignature(page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5), page.Size);
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    PdfGraphics g = signature.Appearence.Normal.Graphics;
    string validto  = "Issuer Name: " + signature.Certificate.IssuerName.ToString()
    string validfrom = "Valid From: " + signature.Certificate.ValidFrom.ToString();
    doc.Pages[0].Graphics.DrawString(validfrom, font, pen, brush, 0, 90);
    doc.Pages[0].Graphics.DrawString(validto, font, pen, brush, 0, 110);
    doc.Pages[0].Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130);
    doc.Pages[0].Graphics.DrawString("* To validate Signature click on the signature on this page \n * To check Document Status \n click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150);
    // Save the PDF file.
    doc.Save("Sample.pdf");
    doc.Close(true);
    Dim doc As PdfDocument = New PdfDocument()
    Dim page As PdfPage = doc.Pages.Add()
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Black)
    Dim pen As PdfPen = New PdfPen(brush, 0.2f)
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular)
    Dim pdfCert As PdfCertificate = New PdfCertificate("PDF.pfx", "syncfusion")
    Dim signature As PdfSignature = New PdfSignature(page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5), page.Size)
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    Dim g As PdfGraphics = signature.Appearence.Normal.Graphics
    Dim validto As String = "Subject Name: " + signature.Certificate.SubjectName.ToString()
    Dim validfrom As String = "Valid From: " + signature.Certificate.ValidFrom.ToString()
    doc.Pages(0).Graphics.DrawString(validfrom, font, pen, brush, 0, 90)
    doc.Pages(0).Graphics.DrawString(validto, font, pen, brush, 0, 110)
    ' Save the PDF file.
    doc.Save("Sample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfFont

    ValidFrom

    Gets the date and time after which the certificate is not valid.[Read-Only]

    Declaration
    public DateTime ValidFrom { get; }
    Property Value
    Type
    System.DateTime
    Remarks

    This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    PdfDocument doc = new PdfDocument();
    PdfPage page = doc.Pages.Add();
    PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
    PdfPen pen = new PdfPen(brush, 0.2f);
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular);
    PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
    PdfSignature signature = new PdfSignature(page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5), page.Size);
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    PdfGraphics g = signature.Appearence.Normal.Graphics;
    string validto  = "Version To: " + signature.Certificate.ValidTo.ToString()
    string validfrom = "Valid From: " + signature.Certificate.ValidFrom.ToString();
    doc.Pages[0].Graphics.DrawString(validfrom, font, pen, brush, 0, 90);
    doc.Pages[0].Graphics.DrawString(validto, font, pen, brush, 0, 110);
    doc.Pages[0].Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130);
    doc.Pages[0].Graphics.DrawString("* To validate Signature click on the signature on this page \n * To check Document Status \n click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150);
    // Save the PDF file.
    doc.Save("Sample.pdf");
    doc.Close(true);
    Dim doc As PdfDocument = New PdfDocument()
    Dim page As PdfPage = doc.Pages.Add()
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Black)
    Dim pen As PdfPen = New PdfPen(brush, 0.2f)
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular)
    Dim pdfCert As PdfCertificate = New PdfCertificate("PDF.pfx", "syncfusion")
    Dim signature As PdfSignature = New PdfSignature(page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5), page.Size)
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    Dim g As PdfGraphics = signature.Appearence.Normal.Graphics
    Dim validto As String = "Version To: " + signature.Certificate.ValidTo.ToString()
    Dim validfrom As String = "Valid From: " + signature.Certificate.ValidFrom.ToString()
    doc.Pages(0).Graphics.DrawString(validfrom, font, pen, brush, 0, 90)
    doc.Pages(0).Graphics.DrawString(validto, font, pen, brush, 0, 110)
    doc.Pages(0).Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130)
    doc.Pages(0).Graphics.DrawString("* To validate Signature click on the signature on this page " + Constants.vbLf + " * To check Document Status " + Constants.vbLf + " click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150)
    ' Save the PDF file.
    doc.Save("Sample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfFont

    ValidTo

    Gets the date and time before which the certificate is not valid.[Read-Only]

    Declaration
    public DateTime ValidTo { get; }
    Property Value
    Type
    System.DateTime
    Remarks

    This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    PdfDocument doc = new PdfDocument();
    PdfPage page = doc.Pages.Add();
    PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
    PdfPen pen = new PdfPen(brush, 0.2f);
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular);
    PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
    PdfSignature signature = new PdfSignature(page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5), page.Size);
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    PdfGraphics g = signature.Appearence.Normal.Graphics;
    string validto  = "Version To: " + signature.Certificate.ValidTo.ToString()
    string validfrom = "Valid From: " + signature.Certificate.ValidFrom.ToString();
    doc.Pages[0].Graphics.DrawString(validfrom, font, pen, brush, 0, 90);
    doc.Pages[0].Graphics.DrawString(validto, font, pen, brush, 0, 110);
    doc.Pages[0].Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130);
    doc.Pages[0].Graphics.DrawString("* To validate Signature click on the signature on this page \n * To check Document Status \n click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150);
    // Save the PDF file.
    doc.Save("Sample.pdf");
    doc.Close(true);
    Dim doc As PdfDocument = New PdfDocument()
    Dim page As PdfPage = doc.Pages.Add()
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Black)
    Dim pen As PdfPen = New PdfPen(brush, 0.2f)
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular)
    Dim pdfCert As PdfCertificate = New PdfCertificate("PDF.pfx", "syncfusion")
    Dim signature As PdfSignature = New PdfSignature(page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5), page.Size)
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    Dim g As PdfGraphics = signature.Appearence.Normal.Graphics
    Dim validto As String = "Version To: " + signature.Certificate.ValidTo.ToString()
    Dim validfrom As String = "Valid From: " + signature.Certificate.ValidFrom.ToString()
    doc.Pages(0).Graphics.DrawString(validfrom, font, pen, brush, 0, 90)
    doc.Pages(0).Graphics.DrawString(validto, font, pen, brush, 0, 110)
    doc.Pages(0).Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130)
    doc.Pages(0).Graphics.DrawString("* To validate Signature click on the signature on this page " + Constants.vbLf + " * To check Document Status " + Constants.vbLf + " click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150)
    ' Save the PDF file.
    doc.Save("Sample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfFont

    Version

    Gets the certificate's version number.[Read-Only]

    Declaration
    public int Version { get; }
    Property Value
    Type
    System.Int32
    Remarks

    This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.

    Examples
    PdfDocument doc = new PdfDocument();
    PdfPage page = doc.Pages.Add();
    PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
    PdfPen pen = new PdfPen(brush, 0.2f);
    PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular);
    PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
    PdfSignature signature = new PdfSignature(page, pdfCert, "Signature");
    signature.Bounds = new RectangleF(new PointF(5, 5), page.Size);
    signature.ContactInfo = "[email protected]";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am author of this document.";
    PdfGraphics g = signature.Appearence.Normal.Graphics;
    string validto = "Version: " + signature.Certificate.Version.ToString();
    string validfrom = "Valid From: " + signature.Certificate.ValidFrom.ToString();
    doc.Pages[0].Graphics.DrawString(validfrom, font, pen, brush, 0, 90);
    doc.Pages[0].Graphics.DrawString(validto, font, pen, brush, 0, 110);
    doc.Pages[0].Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130);
    doc.Pages[0].Graphics.DrawString("* To validate Signature click on the signature on this page \n * To check Document Status \n click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150);
    // Save the PDF file.
    doc.Save("Sample.pdf");
    doc.Close(true);
    Dim doc As PdfDocument = New PdfDocument()
    Dim page As PdfPage = doc.Pages.Add()
    Dim brush As PdfSolidBrush = New PdfSolidBrush(Color.Black)
    Dim pen As PdfPen = New PdfPen(brush, 0.2f)
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12, PdfFontStyle.Regular)
    Dim pdfCert As PdfCertificate = New PdfCertificate("PDF.pfx", "syncfusion")
    Dim signature As PdfSignature = New PdfSignature(page, pdfCert, "Signature")
    signature.Bounds = New RectangleF(New PointF(5, 5), page.Size)
    signature.ContactInfo = "[email protected]"
    signature.LocationInfo = "Honolulu, Hawaii"
    signature.Reason = "I am author of this document."
    Dim g As PdfGraphics = signature.Appearence.Normal.Graphics
    Dim validto As String = "Version: " + signature.Certificate.Version.ToString()
    Dim validfrom As String = "Valid From: " + signature.Certificate.ValidFrom.ToString()
    doc.Pages(0).Graphics.DrawString(validfrom, font, pen, brush, 0, 90)
    doc.Pages(0).Graphics.DrawString(validto, font, pen, brush, 0, 110)
    doc.Pages(0).Graphics.DrawString(" Protected Document. Digitally signed Document.", font, pen, brush, 0, 130)
    doc.Pages(0).Graphics.DrawString("* To validate Signature click on the signature on this page" + vbCrLf + " * To check Document Status" + vbCrLf + " click document status icon on the bottom left of the acrobat reader.", font, pen, brush, 0, 150)
    ' Save the PDF file.
    doc.Save("Sample.pdf")
    doc.Close(True)
    See Also
    PdfDocument
    PdfGraphics
    PdfSignature
    PdfFont

    See Also

    PdfDocument
    PdfGraphics
    PdfFont
    PdfSignature
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved