SignedName |
The SignedName of the PDF digital signature represent the name provided at signing time (it may signer name or any other)
|
SubjectName |
The SubjectName is represent the certificate (.pfx or store certificate) subject name which is used to sign the PDF document.
|
//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 an image for signature field.
PdfBitmap signatureImage = new PdfBitmap("signature.png");
//Sets signature information
signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
signature.LocationInfo = "Honolulu, Hawaii";
signature.Reason = "I am author of this document.";
//Sets signed name of signature
signature.SignedName = "Syncfusion Signature";
//Draws the signature image.
graphics.DrawImage(signatureImage, 0, 0);
//Saves and closes the document.
MemoryStream ms = new MemoryStream();
document.Save(ms);
document.Close(true);
// Load an existing PDF document
PdfLoadedDocument ldoc = new PdfLoadedDocument(ms);
// Gets the first signature field
PdfLoadedSignatureField lField = ldoc.Form.Fields[0] as PdfLoadedSignatureField;
// Gets signed name from signature
string signedName = lField.Signature.SignedName;
//Close the PDF document
ldoc.Close(true);
ldoc.Dispose(); |