After 1.5 years of dedication and hard work, we're pleased to announce that the first internal beta of TX Text Control for Linux is now available exclusively to our internal QA team for extensive testing cycles. This is an important milestone for our team, as it opens up a whole new world of document processing possibilities on one of the most widely used operating systems.
Initial testing has exceeded our expectations, showing remarkable improvements in performance, speed, and a much improved document creation experience. We're excited to see how this new release will change the way applications built with TX Text Control are deployed, bringing unparalleled flexibility and efficiency to Linux users. The future of document automation just got brighter!
The Journey to Linux
In order to bring TX Text Control to Linux, we had to rewrite several key components that were originally tightly bound to Windows. As part of this effort, the window management system had to be significantly modified for cross-platform compatibility. In addition, the font rendering system, which previously relied on Windows-specific technologies, has been completely rewritten to be platform-independent internally. These major updates ensure that TX Text Control provides a consistent and reliable experience on Linux without compromising the high quality rendering and performance that our users expect. More flexible and scalable document processing solutions across multiple platforms have been made possible by this extensive refactoring.
SVG Rendering
In addition to the platform-specific rewrites, we also had to move away from using System.Drawing, along with its GDI and GDI+ dependencies, which were previously essential for rendering images. We wanted to ensure that TX Text Control is not dependent on third-party libraries such as ImageSharp or SkiaSharp, which often have their own limitations and platform-specific constraints. Instead, we took the bold step of implementing our own rendering foundation based entirely on SVG (Scalable Vector Graphics). This approach not only provides greater control over the rendering process, but also ensures cross-platform compatibility and high-quality results.
By using SVG, we're able to provide a sharper, more flexible way to render documents, with consistent performance regardless of the operating system you use. Back in the 90s, we pioneered the ability to render text directly on Windows printer functionality, and today we continue to push the boundaries and shape the future of document and word processing.
MailMerge Performance
One of the most exciting improvements in this release is the performance of document generation. We've streamlined the process to make it faster and more efficient than ever, so you can create documents with complex data sets in record time.
As a first demonstration, we will merge a longer JSON dataset into a standard template that contains merge fields and a repeating block, generating 15 pages of text. This does not sound like much, but the repetition of blocks is an enormous effort for the generation of documents and for the formatting of the whole document. The following screenshot shows our simplified template with a header and logo, static text, merge fields, and a repeating block.
The following code uses the MailMerge class to merge JSON into the template, surrounded by a stopwatch to measure the duration.
// Start measuring time | |
using System.Diagnostics; | |
using TXTextControl.DocumentServer; | |
var watch = Stopwatch.StartNew(); | |
// Create and configure ServerTextControl | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) | |
{ | |
tx.Create(); | |
// Load template document | |
tx.Load("template.tx", TXTextControl.StreamType.InternalUnicodeFormat); | |
// Read JSON data from file | |
string jsonData = File.ReadAllText("data.json"); | |
// Initialize MailMerge component | |
MailMerge mailMerge = new MailMerge | |
{ | |
TextComponent = tx | |
}; | |
// Merge JSON data into the template | |
mailMerge.MergeJsonData(jsonData); | |
// Save the result document | |
tx.Save("results.tx", TXTextControl.StreamType.InternalUnicodeFormat); | |
} | |
// Stop measuring time | |
watch.Stop(); | |
// Output the elapsed time | |
Console.WriteLine($"Elapsed time: {watch.ElapsedMilliseconds} ms"); |
The result is a 15-page repeating block with more than 300 table rows and merged text in each cell.
The same code executed with version 32.0 on Windows results in an average time of 8.5 seconds and above.
On Linux, the same code executed with version 33.0 results in an average time of 1 second and less.
Demo Setup
All demonstrations and tests in this article were conducted on a PC equipped with an AMD Ryzen 7 2700X 8-core processor (3.70GHz) and 16GB of memory to ensure reliable and consistent performance results.
For this particular test, we're using Windows Subsystem for Linux (WSL) with an Ubuntu Linux distribution as our development and testing environment. While WSL provides an excellent way to run Linux applications in a Windows environment, it's worth noting that it is slightly slower than running directly on bare-metal Linux or inside Docker containers. However, the results are incredibly promising and show that the performance improvements we've made are holding up in this intermediate setup. Of course, TX Text Control also runs seamlessly in Docker-based environments or Azure distributions.
Performance Profiler
Let us take a look at the Visual Studio Performance Profiler, comparing version 32.0 with the new core version 33.0.
First of all, let's take a look at the performance of the MailMerge method in version 32.0:
As you can see, the MergeJsonData method is the most CPU-intensive part of the process. This is due to the complexity of the document and the number of merge fields and repeating blocks that need to be processed. You can also see the total time selected in the profiled timeline.
Now, let's take a look at the performance of the MailMerge class in version 33.0:
As you can see, the MergeJsonData method is still the most CPU-intensive part of the process, but the overall performance has been significantly improved. The total time selected in the profiled timeline is much shorter than in version 32.0, indicating that the new core version is faster and more efficient at processing complex documents.
Resource Consumption
CPU time is the actual time the CPU spends executing instructions for a process or thread. Total CPU time takes into account all CPU cores used by a process. Version 32.0 required a total of 7,306 CPU units to complete its task. This high resource consumption resulted in longer execution times and increased energy consumption, especially in resource-constrained environments.
With the optimizations in place, the application now completes the same task using a total of only 1,091 CPU units. This represents an 85% reduction in resource usage, demonstrating the effectiveness of the improvements.
Performance
The new TX Text Control is 85% more resource efficient and delivers a 3.5x performance boost for most tasks and operations, setting a new standard for speed and efficiency!
Table Performance
Now let us look at another area that is very complex and resource intensive: Tables. The following code inserts a table with 500 rows and 8 columns and dynamically sets the text of the 4000 table cells.
// Start measuring time | |
using System.Diagnostics; | |
using TXTextControl.DocumentServer; | |
var watch = Stopwatch.StartNew(); | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) | |
{ | |
// Create the ServerTextControl instance | |
tx.Create(); | |
// Add a table with 500 rows, 8 columns, and a unique ID of 10 | |
tx.Tables.Add(500, 8, 10); | |
// Retrieve the table with the specified ID | |
TXTextControl.Table table = tx.Tables.GetItem(10); | |
// Iterate through each cell in the table | |
foreach (TXTextControl.TableCell cell in table.Cells) | |
{ | |
// Set the text of the cell to include its row and column indices | |
cell.Text = $"Cell: {cell.Row}, {cell.Column}"; | |
} | |
} | |
// Stop measuring time | |
watch.Stop(); | |
// Output the elapsed time | |
Console.WriteLine($"Elapsed time: {watch.ElapsedMilliseconds} ms"); |
On Windows with version 32.0, the average time to complete this task is 5.1 seconds.
Elapsed time: 5118 ms
On Linux with version 33.0, the average time to complete this task is 1.3 seconds.
Elapsed time: 1314 ms
The generation of dynamic tables is now more than 3.5 times faster than before.
Document Editor
Another exciting feature of TX Text Control for Linux is the new Document Editor. With the Document Editor, you can take full advantage of the advanced features of TX Text Control, including tables, images, headers and footers, and more.
The editor functionality has been successfully ported to Linux, allowing TX Text Control based applications to be deployed directly on Linux distributions. This eliminates the need for a separate Windows server to integrate editing capabilities into your applications. With version 33.0, all dependencies on Windows have been completely removed.
The following screenshot shows the TX Text Control document editor in an ASP.NET Core Web application that is hosted 100% on Linux.
The next screenshot shows the Docker container running the TX Text Control application on an Ubuntu distribution.
The Document Viewer will also run completely independent of Windows, providing advanced document viewing, collaboration, and electronic signature workflows.
Azure App Services
Azure App Services is a fully managed platform for building, deploying, and scaling web applications. It provides a reliable and efficient way to host applications on Linux and Windows, taking care of infrastructure management so developers can focus on building great solutions. We're pleased to announce that TX Text Control-based applications can also be seamlessly deployed using Azure App Services for Linux. This makes it easier than ever to bring the power of TX Text Control to cloud-based environments, ensuring scalability, flexibility, and global availability. Whether you're building a document automation system, integrating word processing into your application, or creating complex reports, Azure App Services provides a streamlined and secure deployment option.
With App Service Code, you can deploy your TX Text Control applications directly from your code repository using the convenience of platform-managed runtime environments. For those who prefer more control, the App Service Container allows you to deploy applications as Docker containers, giving you complete flexibility to configure your runtime and dependencies. Both deployment options provide seamless integration with TX Text Control, enabling robust document processing in scalable and cloud-native environments.
The following screenshot shows a distributed sample App Service in the Azure Portal.
Here is a view of the deployed Web site in the Azure App Service shell.
The following screenshot shows the small test application opened in a browser. It renders the HTML generated by the ServerTextControl and generates an Office Open XML DOCX file when the button is clicked.
The following code shows the HttpGet method to return the DOCX document.
[HttpGet] | |
public IActionResult Document() | |
{ | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) | |
{ | |
// Initialize and create the ServerTextControl instance | |
tx.Create(); | |
// Set the text content of the document | |
tx.Selection.Text = "Hello Linux! This text comes from ServerTextControl!"; | |
var selection = new TXTextControl.Selection(0, 12); | |
selection.Bold = true; | |
tx.Selection = selection; | |
tx.Selection.Length = 0; | |
tx.Selection.Start = -1; | |
// Add a 3x3 table with a table ID of 10 | |
tx.Tables.Add(3, 3, 10); | |
// Retrieve the table with the specified ID | |
TXTextControl.Table table = tx.Tables.GetItem(10); | |
// Populate each cell with the text "Cell" | |
foreach (TXTextControl.TableCell cell in table.Cells) | |
{ | |
cell.Text = "Cell"; | |
} | |
// Save the document to a byte array in WordprocessingML format | |
byte[] data; | |
tx.Save(out data, TXTextControl.BinaryStreamType.WordprocessingML); | |
// Return the file as a FileStreamResult with a specific MIME type and filename | |
return File(data, "application/msword", "test.docx"); | |
} | |
} |
Unified Licensing
We're excited to announce that TX Text Control for Linux will be included as part of the standard TX Text Control .NET Server for ASP.NET license. This means that your existing license gives you everything you need to build modern, cross-platform document processing applications.
The license includes NuGet packages for both Windows and Linux, giving you the flexibility to deploy your applications on the platform that best suits your needs. With this unified approach, you'll have access to all the tools you need to create and integrate powerful document processing capabilities into your applications, regardless of the target environment.
Whether you're developing for Windows, Linux, or both, TX Text Control seamlessly leverages the same robust features across platforms, enabling you to deliver exceptional document automation solutions.
We're currently putting the finishing touches on TX Text Control for Linux and conducting extensive testing to ensure it meets the highest standards of performance and reliability. Our team works diligently to refine every detail to ensure a smooth and seamless experience for all users.
Stay tuned for an official release date! We can't wait to bring this powerful new platform to your applications and see the innovative solutions you build with it.