Xamarin.iOS

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfCertificate - Xamarin.iOS 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

    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

    Properties

    IssuerName

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

    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 = "johndoe@owned.us";
    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 = "johndoe@owned.us"
    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

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

    ValidFrom

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

    ValidTo

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

    Version

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

    See Also

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