Importing and Processing Signature Fields from MS Word in C#
TX Text Control signature fields can be signed programmatically using a certificate. This article shows how to import signature fields from an existing MS Word document in order to sign them in a resulting PDF document.

The TX Text Control Signature
Creating Signature Lines in MS Word
To create a document in MS Word that contains a signature line, use the Signature Line button in the Text ribbon group of the Insert ribbon tab.
In the opened dialog, additional information can be added to the signature line. These values are available in the SignatureField class when importing the document into TX Text Control.
After clicking OK, the signature line is inserted into the document.
Processing SignatureFields
After loading the document into TX Text Control, the signature lines are accessible through the Signature
using (TXTextControl.ServerTextControl tx = new ServerTextControl()) {
tx.Create();
tx.Load("test.docx", TXTextControl.StreamType.WordprocessingML);
foreach (SignatureField field in tx.SignatureFields) {
Debug.WriteLine(JsonConvert.SerializeObject(field));
}
}
All signature properties have been imported:
{
"Image":null,
"SignerData":{
"Name":"Klaus Signer",
"Title":"Chief Signer",
"Address":"",
"ContactInfo":"signer@klaus.com",
"Reason":""
}
}
TX Text Control provides additional Signer
Property | Description |
---|---|
Address | Gets the address of a suggested signer. |
ContactInfo | Gets contact information of a suggested signer, such as a phone number. |
Name | Gets the name of a suggested signer. |
Reason | Gets a reason why the document is signed. |
Title | Gets the title of a suggested signer. |
Signing SignatureFields
An X509Certificate2 certificate object is created from a PFX file that is then assigned to all signature fields. The list of signatures is provided through the Signature
using (TXTextControl.ServerTextControl tx = new ServerTextControl()) {
tx.Create();
tx.Load("test.docx", TXTextControl.StreamType.WordprocessingML);
List<TXTextControl.DigitalSignature> digitalSignatures = new List<DigitalSignature>();
foreach (SignatureField field in tx.SignatureFields) {
digitalSignatures.Add(new DigitalSignature(
new System.Security.Cryptography.X509Certificates.X509Certificate2(
"textcontrolself.pfx", "123"), null, field.Name));
}
SaveSettings saveSettings = new SaveSettings() {
SignatureFields = digitalSignatures.ToArray()
};
tx.Save("results.pdf", TXTextControl.StreamType.AdobePDF, saveSettings);
}
Related Posts
ASP.NETASP.NET CoreDocument Editor
Preparing Documents for E-Signing for Multiple Signers in .NET C#
Learn how to prepare documents for e-signing by multiple signers in .NET C#. This article shows how to create signature fields and how to assign them to signers.
Customizing Electronic Signature Fonts for Typed Signatures in Angular and…
This article shows how to customize the electronic signature fonts for typed signatures in Angular and ASP.NET Core. It explains how to use custom fonts for the signature appearance and how to…
Sneak Peek: Retrieving Timestamped Raw Signature Data
We are working on a feature for the Document Viewer that will return the raw signature data from the signature soft pad. This article will provide you with an overview of the functionality and the…
ASP.NETASP.NET CoreElectronic Signature
Customize Signature Fields with Dynamically Created SVG Images
Signature Fields signed using the Document Viewer can be completely customized with bitmap or vector images. This sample shows how to generate custom SVG images with signer information including…
ASP.NETAnnotationsDocumentViewer
DocumentViewer: Aspect Ratio Scaling of Signature Annotations
In the latest version of the DocumentViewer, signature annotations can be scaled by keeping the aspect ratio. This article gives a quick overview of signature annotations and this new feature.