Class PdfSignatureSettings
Represents signature settings used for signing a PDF document.
Inheritance
System.Object
PdfSignatureSettings
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Security
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfSignatureSettings
Examples
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Adds a new page.
PdfPageBase page = document.Pages.Add();
PdfGraphics graphics = page.Graphics;
//Creates a certificate instance from PFX file with private key.
PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
//Creates a digital signature.
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
//Sets signature settings to customize digestion algorithm and cryptographic standrad specified
PdfSignatureSettings properties = signature.Settings;
properties.CryptographicStandard = CryptographicStandard.CADES;
properties.DigestAlgorithm = DigestAlgorithm.SHA256;
//Sets an image for signature field.
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0);
//Saves and closes the document.
document.Save("Output.pdf");
document.Close(true);
'Creates a new PDF document.
Dim document As New PdfDocument()
'Adds a new page.
Dim page As PdfPageBase = document.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
'Creates a certificate instance from PFX file with private key.
Dim pdfCert As New PdfCertificate("PDF.pfx", "syncfusion")
'Creates a digital signature.
Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
'Sets signature settings to customize digestion algorithm and cryptographic standrad specified
Dim properties As PdfSignatureSettings = signature.Settings;
properties.CryptographicStandard = CryptographicStandard.CADES;
properties.DigestAlgorithm = DigestAlgorithm.SHA256;
'Sets an image for signature field.
Dim signatureImage As New PdfBitmap("signature.jpg")
'Sets signature info.
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am author of this document."
'Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0)
'Saves and closes the document.
document.Save("Output.pdf")
document.Close(True)
Properties
CryptographicStandard
Gets or sets cryptographic standard.
Declaration
public CryptographicStandard CryptographicStandard { get; set; }
Property Value
Type | Description |
---|---|
CryptographicStandard | A PdfSignatureSettings object defines signature`s settings. |
Examples
// Creates a new PDF document.
PdfDocument document = new PdfDocument();
// Adds a new page.
PdfPageBase page = document.Pages.Add();
// Creates a certificate instance from PFX file with a private key.
PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
// Creates a digital signature.
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
// Sets signature settings to customize digestion algorithm and cryptographic standard specified.
PdfSignatureSettings properties = signature.Settings;
properties.CryptographicStandard = CryptographicStandard.CADES;
// Sets an image for the signature field.
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
// Sets signature information.
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am the author of this document.";
// Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0);
// Saves and closes the document.
document.Save("Output.pdf");
document.Close(true);
' Creates a new PDF document.
Dim document As New PdfDocument()
' Adds a new page.
Dim page As PdfPageBase = document.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
' Creates a certificate instance from PFX file with a private key.
Dim pdfCert As New PdfCertificate("PDF.pfx", "syncfusion")
' Creates a digital signature.
Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
' Sets signature settings to customize digestion algorithm and cryptographic standard specified.
Dim properties As PdfSignatureSettings = signature.Settings;
properties.CryptographicStandard = CryptographicStandard.CADES;
' Sets an image for the signature field.
Dim signatureImage As New PdfBitmap("signature.jpg")
' Sets signature information.
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am the author of this document."
' Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0)
' Saves and closes the document.
document.Save("Output.pdf")
document.Close(True)
DigestAlgorithm
Gets or sets the digestion algorithm.
Declaration
public DigestAlgorithm DigestAlgorithm { get; set; }
Property Value
Type | Description |
---|---|
DigestAlgorithm | A PdfSignatureSettings object that defines the signature's settings. |
Examples
// Creates a new PDF document.
PdfDocument document = new PdfDocument();
// Adds a new page.
PdfPageBase page = document.Pages.Add();
// Creates a certificate instance from a PFX file with a private key.
PdfCertificate pdfCert = new PdfCertificate(@"PDF.pfx", "syncfusion");
// Creates a digital signature.
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
// Sets signature settings to customize the digestion algorithm and cryptographic standard specified.
PdfSignatureSettings properties = signature.Settings;
properties.DigestAlgorithm = DigestAlgorithm.SHA256;
// Sets an image for the signature field.
PdfBitmap signatureImage = new PdfBitmap(@"signature.jpg");
// Sets signature information.
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
signature.ContactInfo = "johndoe@owned.us";
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am the author of this document.";
// Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0);
// Saves and closes the document.
document.Save("Output.pdf");
document.Close(true);
' Creates a new PDF document.
Dim document As New PdfDocument()
' Adds a new page.
Dim page As PdfPageBase = document.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
' Creates a certificate instance from a PFX file with a private key.
Dim pdfCert As New PdfCertificate("PDF.pfx", "syncfusion")
' Creates a digital signature.
Dim signature As New PdfSignature(document, page, pdfCert, "Signature")
' Sets signature settings to customize the digestion algorithm and cryptographic standard specified.
Dim properties As PdfSignatureSettings = signature.Settings;
properties.DigestAlgorithm = DigestAlgorithm.SHA256;
' Sets an image for the signature field.
Dim signatureImage As New PdfBitmap("signature.jpg")
' Sets signature information.
signature.Bounds = New RectangleF(New PointF(0, 0), signatureImage.PhysicalDimension)
signature.ContactInfo = "johndoe@owned.us"
signature.LocationInfo = "Honolulu, Hawaii"
signature.Reason = "I am the author of this document."
' Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0)
' Saves and closes the document.
document.Save("Output.pdf")
document.Close(True)