An electronic signature is in many processes legally sufficient to prove an identity. According to the U.S. Federal ESIGN Act passed in 2000, an electronic signature is an:

Electronic sound, symbol, or process, attached to or logically associated with a contract or other record and executed or adopted by a person with the intent to sign the record.

This sample project shows how to use the MailMerge class to populate a signature template with a signature image and the name of the signer. This merged template is then loaded into a text frame with a specific name placed in a contract document.

MVC: Added an electronic signature to documents in Web.TextControl

After clicking the button Sign in the added ribbon group Document of the ribbon tab Home, a dialog is opened:

MVC: Added an electronic signature to documents in Web.TextControl

The (demo) name of the signer is coming from an MVC model that would be filled with the user name in a real-world application. When clicking on the Sign button, the controller method SignDocument is called with an asynchronous call. This method merges the signature template with the model data in order to place this signature box into the document by searching for a text frame with the specific name txsig. The Selection.Load method then loads the signature box into the text frame at the proper location:

public string SignDocument(Document model)
byte[] document =
byte[] signatureDocument = null;
using (ServerTextControl tx = new ServerTextControl())
// use MailMerge to merge the signature template
using (MailMerge mailMerge = new MailMerge())
mailMerge.TextComponent = tx;
mailMerge.SearchPath = Server.MapPath("/Signature_Images/");
// create a new signature object
Signature signature = new Signature();
signature.Name = "Peter Chadwick";
signature.SignatureImage =
signature.Name.ToLower().Replace(" ", "_") + ".png";
// merge and save the resulting document
out signatureDocument,
// load the original document from the editor
tx.Load(document, BinaryStreamType.InternalUnicodeFormat);
// find the "signature" text frame with the name "txsig"
foreach (TextFrame frame in tx.TextFrames)
if (frame.Name == "txsig")
frame.Selection.Start = 0;
frame.Selection.Length = -1;
// load the merged signature template into the
// text frame and save the complete document
tx.Save(out document, BinaryStreamType.InternalUnicodeFormat);
// finally, return the signed document
return Convert.ToBase64String(document);
view raw HomeController.cs hosted with ❤ by GitHub

The following screenshot shows the inserted signature box at the end of the document:

MVC: Added an electronic signature to documents in Web.TextControl

Download the sample from GitHub and test it on your own.