Products Technologies Demo Docs Blog Support Company

Why use PDF Templates or Editors when you can use True WYSIWYG Editing?

In this article, we will discuss the advantages of using a true WYSIWYG editing experience for PDF document generation instead of using PDF templates or PDF editors.

Why use PDF Templates or Editors when you can use True WYSIWYG Editing?

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 Editing

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.

Creating documents with TX Text Control

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 class.

Creating documents with TX Text Control

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",
    "address":
    {
      "street": "1111 Text Control Way",
      "zip": "28226",
      "city": "Charlotte",
      "country": "United States"
    }
  }
]

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.Create();
  serverTextControl.Load("template.docx", TXTextControl.StreamType.WordprocessingML, ls);

  using (MailMerge mailMerge = new MailMerge()) {
    mailMerge.TextComponent = serverTextControl;
    mailMerge.MergeJsonData(jsonData);
  }

  // export document as PDF
  serverTextControl.Save("results.pdf", TXTextControl.StreamType.AdobePDF);
}

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

Creating documents with TX Text Control

Conclusion

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.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

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 CoreExtraction

Mining PDFs with Regex in C#: Practical Patterns, Tips, and Ideas

Mining PDFs with Regex in C# can be a powerful technique for extracting information from documents. This article explores practical patterns, tips, and ideas for effectively using regular…


ASP.NETConversionDOCX

PDF Conversion in .NET: Convert DOCX, HTML and more with C#

PDF conversion in .NET is a standard requirement for generating invoices, templates, and accessible reports. This article provides an overview of PDF conversion capabilities using TX Text Control,…


ASP.NETASP.NET CoreForms

Streamline Data Collection with Embedded Forms in C# .NET

Discover how to enhance your C# .NET applications by embedding forms for data collection. This article explores the benefits of using Text Control's ASP.NET and ASP.NET Core components to create…


ASP.NETASP.NET CoreDocument Editor

Getting Started Video Tutorial: Document Editor in ASP.NET Core C# on Linux

This video tutorial shows how to use the Document Editor in an ASP.NET Core application using C# and deploy on Linux using Docker. This tutorial is part of the TX Text Control Getting Started…


ASP.NETASP.NET CorePDF

Adding QR Codes to PDF Documents in C# .NET

This article explains how to add QR codes to PDF documents with the Text Control .NET Server component in C#. It provides the necessary steps and code snippets for effectively implementing this…