# Requesting Electronic Signatures using TX Text Control 31.0

> Requesting signatures is a common application using the TX Text Control document viewer available for ASP.NET, ASP.NET Core and Angular. This article shows a typical workflow how to prepare documents for a signature acquisition.

- **Author:** Bjoern Meyer
- **Published:** 2022-08-18
- **Modified:** 2026-07-17
- **Description:** Requesting signatures is a common application using the TX Text Control document viewer available for ASP.NET, ASP.NET Core and Angular. This article shows a typical workflow how to prepare documents for a signature acquisition.
- **6 min read** (1088 words)
- **Tags:**
  - ASP.NET
  - Document Viewer
  - Digital Signatures
  - Electronic Signatures
  - Version 31.0
- **Web URL:** https://www.textcontrol.com/blog/2022/08/18/requesting-electronic-signatures-using-tx-text-control-310/
- **LLMs URL:** https://www.textcontrol.com/blog/2022/08/18/requesting-electronic-signatures-using-tx-text-control-310/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2022/08/18/requesting-electronic-signatures-using-tx-text-control-310/llms-full.txt

---

> **Sneak Peek 31.0**
> 
> This article, part of a series, describes upcoming features that will be part of the next version of TX Text Control. A release date is not known yet and will be announced separately.

[TX Text Control .NET Server](https://www.textcontrol.com/product/tx-text-control-dotnet-server/) provides all required components to request electronic signatures from users. This article describes a complete typical workflow including document preparation, signature acquisition and the digital signing of the resulting document.

### Preparing the Document

The TX Text Control document editor - available for ASP.NET (Core), Windows Forms and WPF - can be used to prepare a document to request signatures. The *TXTextControl.SignatureField* class represents a signature field in a document. It is a frame object with additional data such as the *SignerData* (address, contact info, name, reason, title) and a name property that is used by the document viewer for the signature acquisition.

1. To insert a new signature field, use the *Signature Field* button in the *Insert* ribbon tab.
    
    ![Signature Fields in TX Text Control](https://s1-www.textcontrol.com/assets/dist/blog/2022/08/18/b/assets/sign_fields.gif "Signature Fields in TX Text Control")
2. Select the signature field and open the *Frame Formatting* contextual ribbon tab. Find the *Name* input field and type in a name for the signature field. For this sample workflow, type in the name *txsign*.
    
    ![Signature Fields in TX Text Control](https://s1-www.textcontrol.com/assets/dist/blog/2022/08/18/b/assets/signaturefield.webp "Signature Fields in TX Text Control")
3. Insert a second signature field into the document and name this field *txsign\_init*.
4. Save this document using the internal TX Text Control format (*StreamType.InternalUnicodeFormat*) and name this document *signature.tx*.

### Deploying the Document

To deploy the document, the TX Text Control document viewer can be used.

> **Getting Started**
> 
> This article describes the workflow using the different components.
> 
> Refer to the documentation or the [Getting Started](https://www.textcontrol.com/product/tx-text-control-dotnet-server/getting-started/) tutorials to learn how to setup an application using the document viewer.

1. Create an ASP.NET (Core) application that uses the document viewer and use the following settings in the MVC Html helper:
    
    ```
    @Html.TXTextControl().DocumentViewer(settings => {
       settings.DocumentPath = Server.MapPath("~/App_Data/signature.tx");
       settings.Dock = DocumentViewerSettings.DockStyle.Fill;
       settings.IsSelectionActivated = false;
       settings.ShowThumbnailPane = true;
       settings.SignatureSettings = new SignatureSettings() {
         ShowSignatureBar = true,
         OwnerName = "Paul Paulsen",
         SignerName = "Tim Typer",
         SignerInitials = "TT",
         UniqueId = uniqueID,
         RedirectUrlAfterSignature = 
          this.Url.Action("SignDocument", "Signature", null, Request.Url.Scheme, null),
         SignatureBoxes = new SignatureBox[] { 
             new SignatureBox("txsign") { 
                SigningRequired = true, Style = SignatureBox.SignatureBoxStyle.Signature },
             new SignatureBox("txsign_init") { 
                SigningRequired = true, Style = SignatureBox.SignatureBoxStyle.Initials }}
       };
    }).Render()
    ```
    
    The following table lists the used *SignatureSettings* in the above MVC Html helper code.
    
    | Setting | Value description |
    |---|---|
    | ShowSignatureBar | Specifies whether to show the blue signature bar on opening the document. |
    | OwnerName | The name of the signature requester that is displayed in the signature bar. |
    | SignerName | The name of the signer that is displayed in the "Setup your Signature" dialog. |
    | SignerInitials | The initials of the signer that is displayed in the "Setup your Signature" dialog. |
    | UniqueId | A unique ID that is included in the graphical representation of the electronic signature. |
    | RedirectUrlAfterSignature | An Url that provides an endpoint to accept the signed document and signature data. |
    | SignatureBoxes | An array of *SignatureBoxes* to define which signature fields should be used based on the given name. Additionally, the style of the signature box can be provided. |
2. After starting your application, you can setup a signature and sign the signature fields. Pay attention to the second field that has been created as an *Initials* field using the given *SignatureBoxes* array in the *SignatureSettings*.
    
    ![Signature Fields in TX Text Control](https://s1-www.textcontrol.com/assets/dist/blog/2022/08/18/b/assets/signing.webp "Signature Fields in TX Text Control")

### Processing and Signing the Document

The document viewer is forwarding an electronically signed document to the given endpoint (provided by the *RedirectUrlAfterSignature* property in the *SignatureSettings*). All signature images are merged into the selected signed signature fields (using the *SignatureBoxes* array in the *SignatureSettings*). This document is forwarded to the given endpoint including a complete *SignatureData* object that holds the document, the signature images and additional data such as completed form fields.

```
public class SignatureData {
  public SignatureDocument SignedDocument { get; set; }
  public string DocumentName { get; set; }
  public string SignatureImage { get; set; }
  public string Name { get; set; }
  public string Initials { get; set; }
  public double InitialsWidth { get; set; }
  public string UniqueId { get; set; }
  public string SignatureBoxName { get; set; }
  public SignatureBox[] SignatureBoxes { get; set; }
  public string DocumentData { get; set; }
  public object CustomSignatureData { get; set; }
  public List<CompletedFormField> FormFields { get; set; } = new List<CompletedFormField>();
  public string RedirectUrl { get; set; }
  public bool CustomSigning { get; set; }
}
```

In case, you only need an electronically signed document, you don't have to implement the following step. The returned document already contains all merged signature images. But if you want to assign a digital signature to the signature fields, the following controller method must be implemented.

1. Create an *HttpPost* endpoint that handles the signature document.
    
    ```
    [HttpPost]
    public string SignDocument()
    {
      // read the payload
      Stream inputStream = Request.InputStream;
      inputStream.Position = 0;
    
      StreamReader str = new StreamReader(inputStream);
      string sBuf = str.ReadToEndAsync().Result;
    
      // retrieve the signature data from the payload
      TXTextControl.Web.MVC.DocumentViewer.Models.SignatureData data =
        JsonConvert.DeserializeObject
        <TXTextControl.Web.MVC.DocumentViewer.Models.SignatureData>(sBuf);
    
      byte[] bPDF;
    
      // create temporary ServerTextControl
      using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
      {
        tx.Create();
    
        // load the document
        tx.Load(Convert.FromBase64String(data.SignedDocument.Document),
          TXTextControl.BinaryStreamType.InternalUnicodeFormat);
        
        // create a certificate
        X509Certificate2 cert = new X509Certificate2(
               Server.MapPath("~/App_Data/textcontrolself.pfx"), "123");
    
        // assign the certificate to the signature fields
        TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings()
        {
          CreatorApplication = "TX Text Control Sample Application",
          SignatureFields = new DigitalSignature[] { 
            new TXTextControl.DigitalSignature(cert, null, "txsign"),
            new TXTextControl.DigitalSignature(cert, null, "txsign_init")}
        };
    
        // save the document as PDF
        tx.Save(out bPDF, TXTextControl.BinaryStreamType.AdobePDFA, saveSettings);
      }
    
      // return as Base64 encoded string
      return Convert.ToBase64String(bPDF);
    }
    ```

In line 24, the signed document is loaded into an instance of ServerTextControl. An *X509Certificate2* is created from a PFX file that is then assigned to the signature fields *txsign* and *txsign\_init*. Eventually, the document is exported and returned as a PDF/A document. At this point, you can store the document server-side, return it to the client or whatever is required in your specific workflow.

### Checking the Signatures

When opening the resulting document in Adobe Acrobat Reader, you can see the visual representations of the signature fields and the signature details in the *Signatures* sidebar:

![Signature Fields in TX Text Control](https://s1-www.textcontrol.com/assets/dist/blog/2022/08/18/b/assets/acrobat.webp "Signature Fields in TX Text Control")

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [HIPAA Compliant Electronic and Digital Signatures](https://www.textcontrol.com/blog/2023/10/27/hipaa-compliant-electronic-and-digital-signatures/llms.txt)
- [Securing the Signature Endpoint with Custom ActionFilterAttributes](https://www.textcontrol.com/blog/2023/07/25/securing-the-signature-endpoint-with-custom-actionfilterattributes/llms.txt)
- [Common Web API Methods for Handling E-Signature Workflows in ASP.NET Core C#](https://www.textcontrol.com/blog/2023/07/20/common-web-api-methods-for-handling-esignature-workflows-in-aspnet-core-csharp/llms.txt)
