Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148883 | Nov 7,2019 03:01 AM UTC | Nov 13,2019 02:25 PM UTC | WinForms | 3 |
![]() |
Tags: PDF |
//Load PDF document
PdfLoadedDocument document = new PdfLoadedDocument("DigitalSignaturee2.pdf");
//Get loaded page
PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;
//Creates a signature field
PdfSignatureField signatureField = new PdfSignatureField(page, "SignatureField");
//Add siganture
signatureField.Bounds = new RectangleF(0, 0, 100, 100);
signatureField.Signature = new PdfSignature(document, page, new PdfCertificate(@"PDF.pfx", "syn
signatureField.Signature.Reason = "I am author of this document";
//Save the document
document.Save();
//Closes the document
document.Close(true);
//Load the documet
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("DigitalSignaturee2.pdf");
//Gets the page of the document
PdfLoadedPage page1 = loadedDocument.Pages[0] as PdfLoadedPage;
//Gets the first signature field of the PDF document.
PdfLoadedSignatureField field2 = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;
//Validate signature and get the validation result
PdfSignatureValidationResult result = field2.ValidateSignature();
//Get value whether document is modified or not
bool isDocumentModified = result.IsDocumentModified; |
Hello,I am using PDF component for adding digital signatures to the pdf document.Here is how I am adding the signaturePdfLoadedDocument document = new PdfLoadedDocument("DigitalSignaturee2.pdf");PdfLoadedPage page = document.Pages[0] as PdfLoadedPage;//Creates a signature field.PdfSignatureField signatureField = new PdfSignatureField(page, "SignatureField");signatureField.Bounds = new RectangleF(0, 0, 100, 100);signatureField.Signature = new PdfSignature(document, page, new PdfCertificate(@"C:\Users\Public\Documents\Syncfusion\ASP.NET MVC - EJ2\16.3.0.21\App_Data\PDF\PDF.pfx", "syncfusion"), "SignatureField");signatureField.Signature.Reason = "I am author of this document";document.Form.Fields.Add(signatureField);document.Save();//Closes the documentdocument.Close(true);I can get the document certificate as of volume 4 release. But how can I verify that document hasn't modified after the signature was added.Here is the code for the signature retrieval.PdfLoadedDocument loadedDocument = new PdfLoadedDocument("DigitalSignaturee2.pdf");//Gets the page of the documentPdfLoadedPage page1 = loadedDocument.Pages[0] as PdfLoadedPage;PdfLoadedSignatureField field2 = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;//Get PDF Certificate instance from signature fieldPdfCertificate certificate = field2.Signature.Certificate;//Get the certificate detailsstring subjectName = certificate.SubjectName;string issuerName = certificate.IssuerName;thanksiosman
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.