We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to digitally sign an existing PDF document?

 

Digital signatures address these security requirements by providing greater assurances of document integrity, authenticity, and non-repudiation. We can digitally sign an existing PDF document using PdfSignature, PdfCertificate classes.

C#

PdfPageBase page = doc.Pages[0];

// Map path of the certificate store.

PdfCertificate pdfCert;

try

{

pdfCert = new PdfCertificate("UserName","Password");

}

catch(Exception ex)

{

debug("Error : please make sure you entered a valid certificate file and password");

debug("Exception : " + ex.ToString());

return;

}

debug("Creating new MetaData ... ");

//Set signature display properties

PdfSignature signature = new PdfSignature(doc, page, pdfCert, "Signature");

PdfBitmap bmp = new PdfBitmap(@"..\..\Data\PDFDemo.jpg");

signature.Bounds = new RectangleF(new PointF(5, 5), bmp.PhysicalDimension);

signature.ContactInfo = Contacttext.Text;

signature.LocationInfo = Locationtext.Text;

signature.Reason = Reasontext.Text;

string validto = "Valid To: " + signature.Certificate.ValidTo.ToString();

string validfrom = "Valid From: " + signature.Certificate.ValidFrom.ToString();

doc.Save(outputBox.Text);

VB

Dim page As PdfPageBase = doc.Pages(0)

''Map path of the certificate store.

Dim pdfCert As PdfCertificate

Try

pdfCert = New PdfCertificate("UserName","Password")

Catch ex As Exception

debug("Error : please make sure you entered a valid certificate file and password")

debug("Exception : " & ex.ToString())

Return

End Try

debug("Creating new MetaData ... ")

''Set signature display properties

Dim signature As PdfSignature = New PdfSignature(doc, page, pdfCert, "Signature")

Dim bmp As PdfBitmap = New PdfBitmap("..\..\Data\PDFDemo.jpg")

signature.Bounds = New RectangleF(New PointF(5, 5), bmp.PhysicalDimension)

signature.ContactInfo = Contacttext.Text

signature.LocationInfo = Locationtext.Text

signature.Reason = Reasontext.Text

Dim validto As String = "Valid To: " & signature.Certificate.ValidTo.ToString()

Dim validfrom As String = "Valid From: " & signature.Certificate.ValidFrom.ToString()

doc.Save(outputBox.Text)

Please look into the sample from the below specified location.

http://www.syncfusion.com/support/user/uploads/Signature_753104ff.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
884 04/30/2011 07/10/2014 Windows Forms PDF
Tags:
Did you find this information helpful?
Comments
Navneet Saraswat Nov 27, 2017

Hi,

the sample download link Signature_753104ff.zip is not working, can you please check?

Thx

Reply
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.