Document.Sign
Overloads
Sign(String, Certificate) | Sign this document digitally. |
Sign(String, Certificate, Boolean) | Digitally sign this document with Time stamping. |
Sign(String, Certificate, TimestampServer) | Digitally sign this document with Time stamping. |
Sign(String, SigningProvider) | Digitally sign this document with SigningProvider. |
Sign(String, Certificate)
Sign this document digitally.
public void Sign(string fieldName, Certificate certificate)
Sub Sign(fieldName As String, certificate As Certificate)
Parameters
- fieldName
- String
Field name of the signature.
- certificate
- Certificate
Reference of type Certificate
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Exceptions
GeneratorException If the document is signed more than once.
Examples
This example shows how to sign a PDF document with an invisible signature.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
'Create a PDF Document
Dim document As Document = New Document
'Create a Page and add it to the document
Dim page As Page = New Page
' Add the page to the document
document.Pages.Add(page)
'Create a Certificate using the system default store
certificate As Certificate = New Certificate("CertificateSubject")
' Sign the document - Invisible
document.Sign("NewFieldName", certificate)
' Save the document
document.Draw("C:\MySignedDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
class MyClass
{
static void Main(string[] args)
{
// Create a PDF Document
Document document = new Document();
// Create a PDF Page
Page page = new Page();
// Add the page to the document
document.Pages.Add(page);
// Create a Certificate using the system default store
Certificate certificate = new Certificate("CertificateSubject");
// Sign the document - Invisible
document.Sign("NewFieldName", certificate);
// Save the document
document.Draw(@"C:\MySignedDocument.pdf");
}
}
Remarks
NOTE: This method requires the .NET Framework 2.0 or greater.
To sign with visible signature, give the Signature field name which is already added into any of the document pages. To sign with invisible, use a different name which does not assign for any of the page elements added into this document pages. Giving existing field name of other page elements apart from Signature will make the document unsigned. This method is not available for .NET standard.Sign(String, Certificate, Boolean)
Digitally sign this document with Time stamping.
public void Sign(string fieldName, Certificate certificate, bool timeStamp)
Sub Sign(fieldName As String, certificate As Certificate, timeStamp As Boolean)
Parameters
- fieldName
- String
Field name of the signature.
- certificate
- Certificate
Reference of type Certificate .
- timeStamp
- Boolean
Timestamp the document using details from the certificate.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Exceptions
GeneratorException If the document is signed more than once.
Examples
This example shows how to sign a PDF document with an invisible signature and Timestamp the signature.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
'Create a PDF Document
Dim document As Document = New Document
'Create a Page
Dim page As Page = New Page
' Add the page to the document
document.Pages.Add(page)
'Create a Certificate using the system default store
Dim certificate As Certificate = New Certificate("CertificateSubject")
' Sign the document - Invisible and mention to Timestamp the signature
document.Sign("NewFieldName", certificate, True)
' Save the document
document.Draw("C:\MyTimestampedDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
class MyClass
{
static void Main(string[] args)
{
// Create a PDF Document
Document document = new Document();
// Create a PDF Page
Page page = new Page();
// Add the page to the document
document.Pages.Add(page);
// Create a Certificate using the system default store
Certificate certificate = new Certificate("CertificateSubject");
// Sign the document - Invisible and mention to Timestamp the signature
document.Sign("NewFieldName", certificate, true);
// Save the document
document.Draw(@"C:\MyTimestampedDocument.pdf");
}
}
Remarks
This method is not available for .NET standard.
Sign(String, Certificate, TimestampServer)
Digitally sign this document with Time stamping.
public void Sign(string fieldName, Certificate certificate, TimestampServer timestampServer)
Sub Sign(fieldName As String, certificate As Certificate, timestampServer As TimestampServer)
Parameters
- fieldName
- String
Field name of the signature.
- certificate
- Certificate
Reference of type Certificate .
- timestampServer
- TimestampServer
Reference of type TimestampServer .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Exceptions
GeneratorException If the document is signed more than once.
Examples
This example shows how to sign a PDF document with an invisible signature and Timestamp the signature.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
'Create a PDF Document
Dim document As Document = New Document
'Create a Page and add it to the document
Dim page As Page = New Page
' Add the page to the document
document.Pages.Add(page)
'Create a Certificate using the system default store
Dim certificate As Certificate = New Certificate("CertificateSubject")
'Create a TimestampServer by passing the Url of the server.
Dim timestampServer As TimestampServer = New TimestampServer("http://ServerURL")
' Sign and timestamp the document - Invisible
document.Sign("NewFieldName", certificate, timestampServer)
' Save the document
document.Draw("C:\MyTimestampedDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
class MyClass
{
static void Main(string[] args)
{
// Create a PDF Document
Document document = new Document();
// Create a PDF Page
Page page = new Page();
// Add the page to the document
document.Pages.Add(page);
// Create a Certificate using the system default store
Certificate certificate = new Certificate("CertificateSubject");
// Create a TimestampServer by passing the Url of the server.
TimestampServer timestampServer = new TimestampServer("http://ServerURL");
// Sign and timestamp the document - Invisible
document.Sign("NewFieldName", certificate, timestampServer);
// Save the document
document.Draw(@"C:\MyTimestampedDocument.pdf");
}
}
Remarks
This method is not available for .NET standard.
Sign(String, SigningProvider)
Digitally sign this document with SigningProvider.
public void Sign(string fieldName, SigningProvider externalSigningProvider)
Sub Sign(fieldName As String, externalSigningProvider As SigningProvider)
Parameters
- fieldName
- String
Field name of the signature.
- externalSigningProvider
- SigningProvider
Reference of type SigningProvider .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Exceptions
GeneratorException If the document is signed more than once.
Remarks
If the document is set for Time stamping then the Certificate should contain the details for Time stamping.