IncrementalUpdateDocument.Sign
Overloads
Sign(String, Certificate) | Marks the document for signing using the specified signature form field name and the Certificate . |
Sign(String, Certificate, IncrementalSignatureAppearance) | Marks the document for signing using the specified signature form field name, the Certificate and with a customized apperance IncrementalSignatureAppearance . |
Sign(String, Certificate, TimestampServer) | Marks the document for signing using the specified signature form field name, the Certificate and a TimestampServer to timestamp the signature. |
Sign(String, Certificate, TimestampServer, IncrementalSignatureAppearance) | Marks the document for signing using the specified signature form field name, the Certificate , TimestampServer to timestamp the signature with a customized apperance IncrementalSignatureAppearance . |
Sign(String, SigningProvider) | Marks the document for signing using the specified signature field and an external signing provider like cloud signing. |
Sign(String, SigningProvider, IncrementalSignatureAppearance) | Mark the document for signing using the signature form field name, the SigningProvider and IncrementalSignatureAppearance . |
Sign(String, Certificate)
Marks the document for signing using the specified signature form field name and the Certificate .
public void Sign(string fieldName, Certificate certificate)
Sub Sign(fieldName As String, certificate As Certificate)
Parameters
- fieldName
- String
Name of the existing signature field.
- 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.
Examples
The following example is for incrementally updating and signing the documentImports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Imports ceTe.DynamicPDF.PageElements.Forms.Signature
Imports ceTe.DynamicPDF.Text
Module MyModule
Sub IncrementalSign(ByVal sourcePdfPath As String, ByVal outPath As String)
' Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
' The source document should have the proper permissions to do the updates.
Dim document As IncrementalUpdateDocument = New IncrementalUpdateDocument(New PdfDocument(sourcePdfPath))
' Update a form field
document.FormFields("name").Value="updated value"
'Create a Certificate from a file.
Dim certificate = New Certificate("c:\MyPersonalCertificate.pfx", "CertificatePassword")
'Sign the document referring the sign field. This Marks the document for signing.
document.Sign("SigFieldName", certificate)
' Save the document
document.Draw(outPath)
End Sub
End Module
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;
public class Example
{
public static void IncrementalSign(string sourcePdfPath, string outPath)
{
//Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
//The source document should have the proper permissions to do the updates.
IncrementalUpdateDocument doc = new IncrementalUpdateDocument(new PdfDocument(sourcePdfPath));
//Update a form field
document.FormFields["name"].Value="updated value"
//Create a Certificate from a file.
var certificate = new Certificate(@"c:\MyPersonalCertificate.pfx", "CertificatePassword"");
//Sign the document referring the sign field. This Marks the document for signing.
doc.Sign("SigFieldName", certificate);
// Save the document
doc.Draw(outPath);
}
}
Remarks
Actual signing happens at the time of creating the PDF content in the Draw method. Signature will be PKCS #7 and covers the complete document contents.
Sign(String, Certificate, IncrementalSignatureAppearance)
Marks the document for signing using the specified signature form field name, the Certificate and with a customized apperance IncrementalSignatureAppearance .
public void Sign(string fieldName, Certificate certificate, IncrementalSignatureAppearance incrementalSignatureAppearance)
Sub Sign(fieldName As String, certificate As Certificate, incrementalSignatureAppearance As IncrementalSignatureAppearance)
Parameters
- fieldName
- String
Name of the existing signature field.
- certificate
- Certificate
Reference of type Certificate .
- incrementalSignatureAppearance
- IncrementalSignatureAppearance
The IncrementalSignatureAppearance of the signature field that specifies different appearance properties of the signature.
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.
Examples
The following example is for incrementally updating and signing the documentImports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Imports ceTe.DynamicPDF.PageElements.Forms.Signature
Imports ceTe.DynamicPDF.Text
Module MyModule
Sub IncrementalSign(ByVal sourcePdfPath As String, ByVal outPath As String)
' Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
' The source document should have the proper permissions to do the updates.
Dim document As IncrementalUpdateDocument = New IncrementalUpdateDocument(New PdfDocument(sourcePdfPath))
' Update a form field
document.FormFields("name").Value="updated value"
'Creates a Certificate from a file.
Dim certificate = New Certificate("c:\MyPersonalCertificate.pfx", "CertificatePassword")
'Create a IncrementalSignatureAppearance.
Dim appearance As IncrementalSignatureAppearance = New IncrementalSignatureAppearance()
'Applies text color for the left Panel.
appearance.LeftPanel.TextColor = RgbColor.Blue
'Applies font for the Siognature field.
appearance.Font = ceTe.DynamicPDF.Font.TimesRoman
'Sign the document referring the sign field. This Marks the document for signing.
document.Sign("SigFieldName", certificate, appearance)
' Save the document
document.Draw(outPath)
End Sub
End Module
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;
class Example
{
public static void IncrementalSign(string sourcePdfPath, string outPath)
{
//Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
//The source document should have the proper permissions to do the updates.
IncrementalUpdateDocument doc = new IncrementalUpdateDocument(new PdfDocument(sourcePdfPath));
//Update a form field
document.FormFields["name"].Value = "updated value"
//Creates a Certificate from a file.
var certificate = new Certificate(@"c:\MyPersonalCertificate.pfx", "CertificatePassword");
//Create a IncrementalSignatureAppearance.
IncrementalSignatureAppearance appearance = new IncrementalSignatureAppearance();
//Applies text color for the left Panel.
appearance.LeftPanel.TextColor = RgbColor.Blue;
//Applies font for the Siognature field.
appearance.Font = Font.TimesRoman;
//Sign the document referring the sign field. This Marks the document for signing.
doc.Sign("SigFieldName", certificate, appearance);
// Save the document
doc.Draw(outPath);
}
}
Remarks
Actual signing happens at the time of creating the PDF content in the Draw method. Signature will be PKCS #7 and covers the complete document contents.
Sign(String, Certificate, TimestampServer)
Marks the document for signing using the specified signature form field name, the Certificate and a TimestampServer to timestamp the signature.
public void Sign(string fieldName, Certificate certificate, TimestampServer timestampServer)
Sub Sign(fieldName As String, certificate As Certificate, timestampServer As TimestampServer)
Parameters
- fieldName
- String
Name of the existing signature field.
- certificate
- Certificate
Reference of type Certificate .
- timestampServer
- TimestampServer
Reference of type TimestampServer that contain the time stamp server details.
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.
Examples
The following example is for incrementally updating and signing the documentImports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Imports ceTe.DynamicPDF.PageElements.Forms.Signature
Imports ceTe.DynamicPDF.Text
Module MyModule
Sub IncrementalSign(ByVal sourcePdfPath As String, ByVal outPath As String)
' Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
' The source document should have the proper permissions to do the updates.
Dim document As IncrementalUpdateDocument = New IncrementalUpdateDocument(New PdfDocument(sourcePdfPath))
' Update a form field
document.FormFields("name").Value="updated value"
'Create a Certificate from a file.
Dim certificate = New Certificate("c:\MyPersonalCertificate.pfx", "CertificatePassword")
'Create TimestampServer
Dim timestampServer As TimestampServer = New TimestampServer("Url of the Timestamp Server")
'Sign the document referring the sign field. This Marks the document for signing.
document.Sign("SigFieldName", certificate, timestampServer)
' Save the document
document.Draw(outPath)
End Sub
End Module
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;
class Example
{
public static void IncrementalSign(string sourcePdfPath, string outPath)
{
//Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
//The source document should have the proper permissions to do the updates.
IncrementalUpdateDocument doc = new IncrementalUpdateDocument(new PdfDocument(sourcePdfPath));
//Create a Certificate from a file.
var certificate = new Certificate(@"c:\MyPersonalCertificate.pfx", "CertificatePassword");
//Update a form field
document.FormFields["name"].Value = "updated value"
//Create TimestampServer
TimestampServer timestampServer = new TimestampServer("Url of the Timestamp Server");
//Sign the document referring the sign field. This Marks the document for signing.
doc.Sign("SigFieldName", certificate, timestampServer);
// Save the document
doc.Draw(outPath);
}
}
Remarks
Actual signing happens at the time of creating the PDF content in the Draw method. Signature will be compatible with PAdES-Basic.
Sign(String, Certificate, TimestampServer, IncrementalSignatureAppearance)
Marks the document for signing using the specified signature form field name, the Certificate , TimestampServer to timestamp the signature with a customized apperance IncrementalSignatureAppearance .
public void Sign(string fieldName, Certificate certificate, TimestampServer timestampServer, IncrementalSignatureAppearance incrementalSignatureAppearance)
Sub Sign(fieldName As String, certificate As Certificate, timestampServer As TimestampServer, incrementalSignatureAppearance As IncrementalSignatureAppearance)
Parameters
- fieldName
- String
Name of the existing signature field.
- certificate
- Certificate
Reference of type Certificate .
- timestampServer
- TimestampServer
Reference of type TimestampServer that containes the time stamp server details.
- incrementalSignatureAppearance
- IncrementalSignatureAppearance
The IncrementalSignatureAppearance of the signature field that specifies different appearance properties of the signature. A null value passed instantiates the appearances with default values.
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
MergerException Throws exception if the source PDF document does not allow making changes to the form fields.
MergerException Throws exception if the source PDF document does not contain the signature field by the specified name.
Examples
The following example is for incrementally updating and signing the documentImports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Imports ceTe.DynamicPDF.PageElements.Forms.Signature
Imports ceTe.DynamicPDF.Text.
Module MyModule
Sub IncrementalSign(ByVal sourcePdfPath As String, ByVal outPath As String)
' Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
' The source document should have the proper permissions to do the updates.
Dim document As IncrementalUpdateDocument = New IncrementalUpdateDocument(New PdfDocument(sourcePdfPath))
' Update a form field
document.FormFields("name").Value="updated value"
'Create a Certificate from a file.
Dim certificate = New Certificate("c:\MyPersonalCertificate.pfx", "CertificatePassword")
'Create a IncrementalSignatureAppearance.
Dim appearance As IncrementalSignatureAppearance = New IncrementalSignatureAppearance()
'Applies text color for the left Panel.
appearance.LeftPanel.TextColor = RgbColor.Blue
'Applies font for the Siognature field.
appearance.Font = ceTe.DynamicPDF.Font.TimesRoman
'Create TimestampServer
Dim timestampServer As TimestampServer = New TimestampServer("Url of the Timestamp Server")
'Sign the document referring the sign field. This Marks the document for signing.
document.Sign("SigFieldName", certificate, timestampServer, appearance)
' Save the document
document.Draw(outPath)
End Sub
End Module
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;
class Example
{
public static void IncrementalSign(string sourcePdfPath, string outPath)
{
//Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
//The source document should have the proper permissions to do the updates.
IncrementalUpdateDocument doc = new IncrementalUpdateDocument(new PdfDocument(sourcePdfPath));
//Update a form field
document.FormFields["name"].Value = "updated value"
//Create a Certificate from a file.
var certificate = new Certificate(@"c:\MyPersonalCertificate.pfx", "CertificatePassword");
//Create a IncrementalSignatureAppearance.
IncrementalSignatureAppearance appearance = new IncrementalSignatureAppearance();
//Applies text color for the left Panel.
appearance.LeftPanel.TextColor = RgbColor.Blue;
//Applies font for the Siognature field.
appearance.Font = Font.TimesRoman;
//Create TimestampServer
TimestampServer timestampServer = new TimestampServer("Url of the Timestamp Server");
//Sign the document referring the sign field. This Marks the document for signing.
doc.Sign("SigFieldName", certificate, timestampServer, appearance);
// Save the document
doc.Draw(outPath);
}
}
Remarks
Actual signing happens at the time of creating the PDF content in the Draw method. Signature will be compatible with PAdES-Basic.
Sign(String, SigningProvider)
Marks the document for signing using the specified signature field and an external signing provider like cloud signing.
public void Sign(string fieldName, SigningProvider signingProvider)
Sub Sign(fieldName As String, signingProvider As SigningProvider)
Parameters
- fieldName
- String
Name of the existing signature field.
- signingProvider
- 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.
Examples
The following example is for incrementally updating the signature field with a third party signing provider.using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;
class Example
{
public static void IncrementalSign(string source, string outPath)
{
//Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
//The source document should have the proper permissions to do the updates.
IncrementalUpdateDocument document = new IncrementalUpdateDocument(new PdfDocument(source));
//Update a form field
document.FormFields["name"].Value = "updated value"
//Create a Certificate from a file.
var clientCertificate = new X509Certificate2(@"C:\MyPersonalCertificate.pfx", "CertificatePassword");
var certificate = new ceTe.DynamicPDF.GlobalSignCloudSigningProvider("api_key", "api_secret", clientCertificate);
//Input as a JSON string
certificate.IdentityBody = "{\"subject_dn\":{\"common_name\":\"SubjectName \"}}";
//Sign the document referring the sign field. This Marks the document for signing.
document.Sign("SigFieldName", certificate);
// Save the document
document.Draw(outPath);
}
}
Remarks
Actual signing happens at the time of creating the PDF content in the Draw method. A document can be either signed or certified or timestamped. For signing or certifying and document timestamp it has to be done through multiple incremental updates.
Sign(String, SigningProvider, IncrementalSignatureAppearance)
Mark the document for signing using the signature form field name, the SigningProvider and IncrementalSignatureAppearance .
public void Sign(string fieldName, SigningProvider signingProvider, IncrementalSignatureAppearance incrementalSignatureAppearance)
Sub Sign(fieldName As String, signingProvider As SigningProvider, incrementalSignatureAppearance As IncrementalSignatureAppearance)
Parameters
- fieldName
- String
Name of the existing signature field.
- signingProvider
- SigningProvider
Reference of type SigningProvider .
- incrementalSignatureAppearance
- IncrementalSignatureAppearance
The IncrementalSignatureAppearance of the signature field that specifies different appearance properties of the signature. A null value passed instantiates the appearances with default values.
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
MergerException Throws exception if the source PDF document does not allow making changes to the form fields.
MergerException Throws exception if the source PDF document does not contain the signature field by the specified name.
Examples
The following example is for incrementally updating the signature field with a third party signing provider.using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;
class Example
{
public static void IncrementalSign(string source, string outPath)
{
//Create an IncrementalUpdateDocument object using the source PDF that is being updated incrementally.
//The source document should have the proper permissions to do the updates.
IncrementalUpdateDocument document = new IncrementalUpdateDocument(new PdfDocument(source));
//Update a form field
document.FormFields["name"].Value = "updated value"
//Create a Certificate from a file.
var clientCertificate = new X509Certificate2(@"C:\MyPersonalCertificate.pfx", "CertificatePassword");
var certificate = new ceTe.DynamicPDF.GlobalSignCloudSigningProvider("api_key", "api_secret", clientCertificate);
//Input as a JSON string
certificate.IdentityBody = "{\"subject_dn\":{\"common_name\":\"SubjectName \"}}";
//Create a IncrementalSignatureAppearance.
IncrementalSignatureAppearance appearance = new IncrementalSignatureAppearance();
//Applies text color for the left Panel.
appearance.LeftPanel.TextColor = RgbColor.Blue;
//Applies font for the Siognature field.
appearance.Font = Font.TimesRoman;
//Sign the document referring the sign field. This Marks the document for signing.
document.Sign("SigFieldName", certificate, appearance);
// Save the document
document.Draw(outPath);
}
}
Remarks
Actual signing happens at the time of creating the PDF content in the Draw method. A document can be either signed or certified or timestamped. For signing or certifying and document timestamp it has to be done through multiple incremental updates.