Adding a Timestamp to Signatures and Certificates

Add a timestamp to a signature to show the date and time a document was signed. Both visible and non-visible signatures can be time stamped.

Specifying a Timestamp Server URL

If a signature is time-stamped from a timestamp server, create a TimeStampServer instance. Pass the TimeStampServer object's timestamp server URL and, if necessary, the connection's user name and password. The TimeStampServer object is then passed to the Document class's Sign method along with the certificate and the signature field name. The following example illustrates using a TimeStampServer instance to specify a server URL that time-stamps a signature.

Document document = new Document(); 
Page page = new Page(); 

// Create  add Signature Form Field
Signature signature = new Signature("SigField", 10, 10, 250, 100); 
page.Elements.Add(signature); 
document.Pages.Add(page); 
Certificate certificate = new Certificate(@"C:\PersonalFiles\JohnDoe.pfx", "password"); 

// Create TimestampServer
TimestampServer timestampServer = new TimestampServer("Url of the Timestamp Server");
document.Sign("SigField", certificate, timestampServer);
document.Draw(pdfFilePath);         
Dim MyDocument As New Document()
Dim MyPage As New Page()

' Create & add Signature Form Field 
Dim MySignature As New Signature("SigField", 10, 10, 250, 100)
MyPage.Elements.Add(MySignature)
MyDocument.Pages.Add(MyPage)
Dim MyCertificate As New Certificate("C:\Data\JohnDoe.pfx"), "password")

' Create TimestampServer 
Dim MyTimestampServer As New TimestampServer("Url of the Timestamp Server")
MyDocument.Sign("SigField", MyCertificate, MyTimestampServer)
MyDocument.Draw(pdfFilePath)    

Using a Timestamp Server URL from a Certificate

Use the Document class's Sign method to set the signature field name, the Certificate instance, and a Boolean value. If the Boolean value is true, the signature is time-stamped using the details in the Certificate object. If a certificate already contains a timestamp server URL, then you can use this URL rather than creating a TimeStampServer instance.

Sign(String, Certificate, Boolean)	//Digitally sign document with Time stamp

This example demonstrates using a time stamp server URL specified in a Certificate object.

A Certificate instance's TimeStampServerUrl property allows determining if a time stamp server is already set. If the property contains a URL, it returns the URL; otherwise, it returns Null.

Document document = new Document(); 
Page page = new Page(); 

// Create & add Signature Form Field
Signature signature = new Signature("SigField", 10, 10, 250, 100); 
page.Elements.Add(signature); 
document.Pages.Add(page); 
Certificate certificate = new Certificate(@"C:\PersonalFiles\JohnDoe.pfx", "password"); 
document.Sign("SigField", certificate, true);
document.Draw(pdfFilePath);        
Dim MyDocument As New Document()
Dim MyPage As New Page()

' Create  add Signature Form Field 
Dim MySignature As New Signature("SigField", 10, 10, 250, 100)
MyPage.Elements.Add(MySignature)
MyDocument.Pages.Add(MyPage)
Dim MyCertificate As New Certificate("C:\Data\JohnDoe.pfx", "password")

MyDocument.Sign("SigField", MyCertificate, True)
MyDocument.Draw(pdfFilePath)

In this topic