Document Processing Examples
ServerTextControl works without a user interface, so its samples are mostly console applications and Web APIs: they load a document, change or analyze it and save the result. The online demos show the same operations with a viewer or editor for the result, and an interactive lab lets you change the code of a document and see the pages it produces. Most of the sample projects target the current version, 34.0, with the Core engine.
Online Demos
| Example | What it shows | Where |
|---|---|---|
| Word formats | A DOCX document converted on the server to PDF, RTF or HTML | MS Word Formats |
| Markdown | Markdown loaded into an editable document and the edited document saved back as Markdown with TXTextControl.Markdown.Core | Markdown Import and Export |
| CSV to PDF | CSV data turned into a formatted, paginated table in a PDF document | CSV to PDF |
| Selections | Formatting text with the current selection compared with prepared Selection objects, with the pages rendered as SVG | Selection API |
| Paragraph formatting | Alignment, spacing, indents, frames and page breaks of paragraphs | Paragraph Format API |
| Styles | Paragraph styles created, applied, inherited and changed | Stylesheet API |
| Fields | Fields created, read, updated and removed | Application Fields API |
| Headers and footers | Headers and footers per section, first-page variants and page number fields | Headers and Footers API |
| Tables | Tables created, filled, formatted, resized and calculated | Tables API |
| Redaction | Confidential text replaced by redaction graphics in the Document Editor | Document Redaction |
The demos of the Interactive Coding section are a guided lab: you change the C# code of the example and see the result, within a set of allowed members. The demos of document analysis, such as classification and sanitization, are listed in AI Examples.
Sample Projects
These samples target version 34.0 with the Core engine:
| Example | What it shows | Where |
|---|---|---|
| Tracked changes | A report of all tracked changes of a DOCX document with type, author and time, and the changes accepted or rejected, as described in Inspect and Process Track Changes in DOCX Documents with TX Text Control with .NET C#. .NET 10 | TXTextControl.TrackChanges.Core |
| Track changes review | An ASP.NET Core application that lists the documents with tracked changes, shows each change with its author and time, filters them, accepts or rejects them one by one or in bulk and previews their place on the page as SVG, as described in Building a Modern Track Changes Review Workflow in ASP.NET Core C#. .NET 10 | TXTextControl.TrackChanges.Review |
| Tables to CSV | All tables of a document exported as CSV, with header rows and custom separators, as described in Export Document Tables to CSV in .NET C#. .NET 8 | TXTextControl.TableToCSV |
| CSV to a table | CSV data converted into a table and saved as PDF, as described in Convert CSV to PDF in .NET C#. .NET 10 | TXTextControl.Core.CSVToTable |
| HTML to Markdown | All HTML files of a folder converted to Markdown with TXTextControl.Markdown.Core, as described in Converting HTML to Markdown in C# .NET. .NET 10 | TXTextControl.HtmlToMD |
| SSRS reports | RDL report definitions of SQL Server Reporting Services converted into DOCX or TX Text Control templates with merge fields and blocks, with a conversion report, as described in Convert SSRS RDL Reports to DOCX and TX Text Control Templates in .NET C#. .NET 10 | TXTextControl.Rdl2Tx |
| Template dependencies | Fonts, linked images, merge fields, merge blocks and form fields of templates checked before a deployment, for example from Windows to Linux, as described in Check TX Text Control Template Dependencies Before Deployment. .NET 10 | TXTextControl.Check.Dependencies |
| Styles from regular expressions | Inline styles applied to text that matches regular expressions from JSON rules, then exported as PDF, as described in RegEx Based Inline Styling in TX Text Control Using JSON Rules. .NET 10 | TXTextControl.Core.RegExToStyle |
| Personal data | A DOCX document scanned for personal and health data with rules and regular expressions, with the findings and recommendations printed, as described in A Rule-Based PHI and PII Risk Scanner for Documents Using C# .NET. .NET 8 | TXTextControl.Core.PHIScanner |
Linux, Docker and Web APIs
These samples were written for version 33.0 with the Core engine:
| Example | What it shows | Where |
|---|---|---|
| DOCX to PDF from Java | A .NET console tool that converts DOCX to PDF, called from a Java application in one Docker container, as described in Converting Office Open XML (DOCX) to PDF in Java | TXTextControl.Core.Java.Convert |
| Markdown to PDF | A command-line converter from Markdown to PDF for Linux and Windows, as described in Convert Markdown to PDF in a Console Application on Linux and Windows. It references a prerelease of TXTextControl.Markdown.Core | TXTextControl.Markdown.Md2Pdf |
| PDF generation Web API | An ASP.NET Core Web API on Linux with a clean architecture that merges templates and returns PDF documents, deployable with Docker, as described in Designing a Maintainable PDF Generation Web API in ASP.NET Core (Linux) C# with Clean Architecture and TX Text Control | TXTextControl.Core.MailMerge.API |
Older Samples
| Example | What it shows | Where |
|---|---|---|
| Redaction | A class that replaces marked text with images of the same size before the document is saved as PDF, as described in True Document and PDF Text Redaction in .NET C#. The repository contains the class only | Redaction |
| Comparison by images | Two documents compared pixel by pixel as page images, as described in Document Comparison using Image-Based Pixel Matching in .NET C#. Version 32.0 with the Classic engine | TXTextControl.Compare.Pixel |
Blog Articles With Code
| Example | What it shows | Where |
|---|---|---|
| A console application on Linux | ServerTextControl and MailMerge in a .NET 8 console application in a Linux container | Getting Started: ServerTextControl and MailMerge in a .NET 8 Console Application on Linux with Docker and WSL |
| Visual Studio Code on Linux | A console application created with Visual Studio Code that creates a PDF | Creating a .NET Console Application with Visual Studio Code and TX Text Control (on Linux) |
| DOCX documents on Linux | DOCX documents created in code in a Linux container | How to Programmatically Create MS Word DOCX Documents with .NET C# on Linux |
| Faster generation | Documents built about twice as fast with prepared Selection objects instead of formatting the live selection after inserting the text | Speed Up Document Generation by Factor 2 Using Selection Objects in .NET C# |
| Text replacement in large files | Placeholders replaced in hundreds of large DOCX files | High-Performance Text Replacement in Large DOCX Files using C# .NET |
Next Steps
- Mail Merge Examples: templates merged with data.
- PDF Examples: PDF documents, forms and electronic invoices.
- Document Processing: the tasks of
ServerTextControlin detail.