Products Technologies Demo Docs Blog Support Company

Transforming Financial Documents into Smart and Secure Forms in ASP.NET Core C#

This article shows how to transform financial documents into smart and secure forms in ASP.NET Core C#. All the necessary steps, from prepopulating the form fields to digital signatures, are explained in this article.

Transforming Financial Documents into Smart and Secure Forms in ASP.NET Core C#

In financial processes, a hard copy of all agreements and contracts is required by law. Whether you have a mobile data capture front-end, a powerful document viewer, or any other data capture process, the end result is a digitally signed PDF or hard copy.

Digital document processing became popular and necessary during the pandemic. After these years, digital processes have become the expectation of the users. The digital transformation of the financial industry is a must.

The need to visit a bank branch is almost obsolete, and this change in customer behavior was the driving force behind the innovation. The financial industry is now more focused on digital transformation than ever before. But regulatory requirements and user expectations demand that the digital process be smooth and effortless, and the PDF be pixel perfect.

Digital Forms Processing

Forms processing is a common task in the financial industry. The forms can be anything from a simple application form to a complex contract. Let's take a look at the Merchant Application form below.

Forms processing with TX Text Control

TX Text Control libraries support the complete form lifecycle, from form creation and design, to data capture, to final PDF generation with digital signatures. The following screenshot shows the Document Editor used to design the form.

Forms processing with TX Text Control

It provides a full-featured WYSIWYG editor for users to create a form template with form fields, pixel-perfect layout, formulas, and signature fields. The form can be saved in a proprietary format or as a template in the industry-standard DOCX format.

The fact that the document lives in an editable format rather than being added to the process as a PDF is a huge advantage of the TX Text Control ecosystem. The form can be edited, updated, and changed without the need to re-create the PDF. At the very end, the document is generated as a print-ready and archivable PDF document.

Data Preparation

After the form is designed, the form should be filled out by the user. The data capture process can be done in various ways. The form can be filled out in a web application, a mobile app, or a desktop application. The data is then sent to the server where the data is processed and merged into the form template.

But before the form is presented to the end user, known data can be pre-populated into the form fields. This can be done by using a data merge process that merges the form template with a data source. The following screenshot shows the Document Viewer when no data is merged into the form.

Data preparation with TX Text Control

The following code uses JSON data merged into form fields to pre-select the known fields.

public IActionResult Index()
{
    using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
    {
        tx.Create();
        tx.Load("App_Data/gpay_application.tx", TXTextControl.StreamType.InternalUnicodeFormat);

        var jsonData = System.IO.File.ReadAllText("App_Data/data.json");

        using (MailMerge mm = new MailMerge())
        {
          mm.TextComponent = tx;
          mm.FormFieldMergeType = FormFieldMergeType.Preselect;
          mm.MergeJsonData(jsonData);
        }

        byte[] data;
        tx.Save(out data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);

        ViewBag.Document = Convert.ToBase64String(data);
    }

    return View();
}

The following JSON data is merged into the form fields:

[
  {
    "business": {
      "dba": {
        "name": "My Business",
        "street": "123 Main St",
        "city": "Anytown",
        "state": "North Carolina",
        "zip": "12345",
        "phone": "555-555-5555",
        "contact": "John Doe",
        "email": "",
        "website": ""
      },
      "legal": {
        "name": "My Business",
        "street": "123 Main St",
        "city": "Anytown",
        "state": "North Carolina",
        "zip": "12345",
        "phone": "555-555-5555",
        "contact": "John Doe",
        "email": "",
        "website": ""
      }
    },
    "merchant": {
      "ticker": "123456",
      "ownership": "Corporation",
      "goods": "Retail",
      "sic": "1234",
      "years": "5",
      "taxid": "123-45-6789",
      "type_retail": true,
      "signer": "John Doe",
      "sales": {
        "swiped": "80",
        "keyed": "10",
        "internet": "5",
        "order": "5"
      },
      "acceptno": true
    }
  }
]

The Document Viewer with the JSON data merged into the form fields is shown in the following screenshot.

Data preparation with TX Text Control

Formulas and Validation

When merging data into form fields, formulas are automatically evaluated. The following screenshot shows a formula that calculates the percentage of the given sales profile.

Data preparation with TX Text Control

In addition, TX Text Control provides complex form validation and automation using conditional instructions that are evaluated as the user fills out the form.

Digital Signatures

After the form is filled out, the user can digitally sign the document. The following screenshot shows the Document Viewer with a digital signature field.

Digital signatures with TX Text Control

The following code applies the digital signature using a certificate to the signature field and exports the document as a digitally signed PDF/A document.

[HttpPost]
public string CreatePdf([FromBody] TXTextControl.Web.MVC.DocumentViewer.Models.SignatureData signatureData)
{
    byte[] bPDF;

  // create temporary ServerTextControl
  using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
  {
    tx.Create();

    // load the document
    tx.Load(Convert.FromBase64String(signatureData.SignedDocument.Document),
      TXTextControl.BinaryStreamType.InternalUnicodeFormat);

    FlattenFormFields(tx);

    // create a certificate
    X509Certificate2 cert = new X509Certificate2("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")
              }
    };

    // save the document as PDF
    tx.Save(out bPDF, TXTextControl.BinaryStreamType.AdobePDFA, saveSettings);
  }

  // return as Base64 encoded string
  return Convert.ToBase64String(bPDF);
}

The screenshot below is a view of the digitally signed PDF document.

Digital signatures with TX Text Control

Conclusion

TX Text Control provides a complete solution for digital forms processing in the financial industry. The complete lifecycle from form design to data capture to digital signatures is supported by the Document Editor, Document Viewer, and the Document Processing Web API.

With the ability to merge data into form fields, evaluate formulas, and apply digital signatures, TX Text Control is the perfect choice for digital transformation in the financial industry.

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

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on github.com/TextControl.

Please fork and contribute.

Download ZIP

Open on GitHub

Open in Visual Studio

Requirements for this sample

  • Visual Studio 2022
  • TX Text Control .NET Server

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETASP.NET CoreDocument Viewer

High-Performance Text Replacement in Large DOCX Files using C# .NET

Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…


ASP.NETASP.NET CoreDocument Viewer

Document Viewer 33.2.1 Released: New Event and Bug Fixes

This service pack includes important bug fixes and improvements to enhance the stability and performance of the Document Viewer. In addition, a new event has been introduced to provide developers…


ASP.NETBlazorASP.NET Core

E-Sign Comes to Blazor: Document Viewer 33.0.1 Released

We are excited to announce the release of TX Text Control Document Viewer 33.0.1 for Blazor! This version comes packed with one of the most requested features: Electronic signature support.


ASP.NETASP.NET CoreE-Sign

Adoption of Electronic vs. Paper Signatures in 2025

The move to electronic signatures has accelerated in recent years. However, many organizations still rely on paper signatures for core processes. This article examines the current state of…


AngularASP.NETBlazor

Building an ASP.NET Core Backend (Linux and Windows) for the Document Editor…

This article shows how to create a backend for the Document Editor and Viewer using ASP.NET Core. The backend can be hosted on Windows and Linux and can be used in Blazor, Angular, JavaScript, and…