PDFs are everywhere: Invoices, brochures, contracts and agreements. It is a highly reliable, portable format that has become the clear industry standard for document exchange. TX Text Control is used to create PDF documents and is the perfect tool for creating pixel-perfect PDF documents with attachments, embedded fonts, and document access settings in multiple formats, including PDF/A and PDF/A-3b.

A PDF document should be the end result of a document automation process and not the intermediate format used as a template. From the beginning, when PDF was introduced, the format was not intended to be changed. The editors available are far from being perfect for PDF document editing. The reasons are very straightforward.

  • PDF documents are not designed to be edited.
  • PDF may not contain elements such as paragraphs or tables.
  • PDF is page-oriented and is not designed to support floating text.

Complex structures are required to circumvent these design limitations, which are cumbersome.

Important: As a dynamic structure that can be updated at any time, a document should be editable for as long as possible.

When is the right time to create a PDF file that is essentially a "write-only" file?

It is possible to make changes to a created PDF document. For example, you can replace small pieces of text or remove entire pages. But you get an idea of how dynamic digital document processing should be when you think of a PDF as a printed sheet of paper. A document should be editable for as long as possible. It is a dynamic structure that should be able to be updated at any time until the process is complete and a document is created for further processing or archiving.


WYSIWYG ("what-you-see-is-what-you-get") editing is a method that allows the user to directly manipulate the layout of a document. The user can see the end result while the document is being created. This is the most intuitive way to create documents and is the most common way to create documents in word processors such as Microsoft Word.

The document editor of TX Text Control with MS Word compatible look and feel is shown in the following screenshot.

TX Text Control is available for ASP.NET, ASP.NET Core, Angular, React, JavaScript, Windows Forms, and WPF.

This concept should also be applied to the creation of templates that will be used for the generation of PDF documents. TX Text Control allows you to integrate template editing directly into your application, providing the following benefits.

  • Browser-independent, true WYSIWYG editing
    TX Text Control provides true WYSIWYG editing in all browsers and on all devices. The editor is based on HTML5 and JavaScript and is independent of the browser and the platform.
  • MS Word look and feel
    The editor provides a MS Word look and feel and supports all word processing features such as tables, headers and footers, sections and merge fields.
  • Import and export MS Word formats
    The editor supports importing and exporting MS Word formats such as DOC, DOCX and RTF. This allows you to use existing MS Word documents as templates and to export the created documents to MS Word formats.
  • PDF document generation
    The editor provides a powerful mail merge feature to create documents based on templates. The merge process can be executed on the server or in the browser to create PDF documents.

The MailMerge Process

TX Text Control provides a powerful mail merge process to create documents based on these created templates. The merge process can be executed on the server or in the browser to create PDF documents.

When the final PDF is created, the designed template is used and merged with data from supported data sources such as JSON. The ease with which the final PDF file can be generated will be demonstrated in this chapter. The following simple template is used for the merge process using the MailMerge TX Text Control .NET Server for ASP.NET
DocumentServer Namespace
MailMerge Class
The MailMerge class is a .NET component that can be used to effortlessly merge template documents with database content in .NET projects, such as ASP.NET web applications, web services or Windows services.

As a simplified data source, the following JSON data is used. Complex hierarchical data with nested merge block structures is supported by TX Text Control.

"company_name": "Text Control, LLC",
"street": "1111 Text Control Way",
"zip": "28226",
"city": "Charlotte",
"country": "United States"
view raw data.json hosted with ❤ by GitHub

The following C# code merges JSON data into MS Word compatible merge fields to create the resulting PDF document.

TXTextControl.LoadSettings ls = new TXTextControl.LoadSettings() {
ApplicationFieldFormat = TXTextControl.ApplicationFieldFormat.MSWord };
string jsonData = System.IO.File.ReadAllText("data.json");
using (TXTextControl.ServerTextControl serverTextControl =
new TXTextControl.ServerTextControl()) {
serverTextControl.Load("template.docx", TXTextControl.StreamType.WordprocessingML, ls);
using (MailMerge mailMerge = new MailMerge()) {
mailMerge.TextComponent = serverTextControl;
// export document as PDF
serverTextControl.Save("results.pdf", TXTextControl.StreamType.AdobePDF);
view raw test.cs hosted with ❤ by GitHub

As a result, the PDF document is created based on the template and the JSON data.


Using a true WYSIWYG editing experience for PDF document generation instead of using PDF templates or PDF editors has many advantages. The document editor of TX Text Control provides a powerful and easy-to-use way to create templates for PDF document generation. The mail merge process is a powerful way to merge data into these templates to create final PDF documents.

Check out our online demos to try out the Document Editor for yourself.