# ServerTextControl

> Create, convert and edit DOCX and PDF documents in .NET code with ServerTextControl: Core or Classic package, Create, Load and Save, StreamType and key members.

- **Product:** TX Text Control .NET Server
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET Server > Overview > Components > ServerTextControl
- **2033 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/servertextcontrol/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/servertextcontrol/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/servertextcontrol/llms-full.txt

---

`ServerTextControl` is the document processing component of TX Text Control .NET Server that you use in code. The sections below describe what it is and what you do with it, where it runs, which packages contain it and which members you use most. A first application with it is built step by step in [Getting Started: Document Processing](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/llms-full.txt).

### What ServerTextControl Is

`ServerTextControl` is TX Text Control without a user interface: a non-visual component that provides high-level word processing features for server-based applications. The class is `TXTextControl.ServerTextControl`, and it is derived from `System.ComponentModel.Component`.

Its word processing functions are available as properties and methods: you insert and format text, add tables and images, and select parts of the text in code. You create an instance, build or load a document, change it, and save the result in the format you need.

`ServerTextControl` is also the base for other parts of the product. [MailMerge](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/mailmerge/llms-full.txt) uses a `ServerTextControl` instance to hold the template and the merged document, and documents that users edit in the [Document Editor](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/document-editor/llms-full.txt) or sign in the [Document Viewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/document-viewer/llms-full.txt) can be processed further with `ServerTextControl` on the server.

### What You Do With It

- **Create documents** from scratch, such as letters, invoices or reports, with formatted text, tables, images, headers and footers.
- **Load and convert documents.** Load DOCX, RTF, HTML, PDF and other formats, and save them in another format. For example, you convert a DOCX file to PDF by loading it and saving it as PDF.
- **Change existing documents** by inserting, editing or deleting content, and work with the elements of a document, such as fields, form fields, comments and tracked changes. For example, you can read the tracked changes of a DOCX document and accept or reject them in code.
- **Create PDF documents**, including PDF/A for long-term archiving, set document metadata, and sign PDF documents digitally with a certificate when you save them.
- **Import PDF documents** to extract their text or to change them and save them again.
- **Merge data into templates** with the `MailMerge` class.

`ServerTextControl` loads from and saves to a file, a file stream, a byte array or a string, so you can return a document from a Web API, store it in a database or attach it to an email without writing a file first.

### Where It Runs

Because it needs no user interface, you can use `ServerTextControl` wherever .NET code runs on a server or in the background:

- ASP.NET Core web applications and Web APIs
- Console applications
- Services and other server-side processes

`ServerTextControl` is part of both TX Text Control engines, which target .NET 8 or higher, and both contain the class in the `TXTextControl` namespace, so your code is the same. With the Core package `TXTextControl.TextControl.Core.SDK`, it runs on Windows and Linux, including Docker containers; with the Classic package `TXTextControl.TextControl.ASP.SDK`, on Windows only, but with DOC import and export. Core is recommended for new projects, and [Core and Classic](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/architecture/#the-document-engine) compares the engines. Both packages are available on the [Text Control Private NuGet Feed](https://docs.textcontrol.com/tx-text-control-dotnet-server/installation/nuget/private-feed/llms-full.txt).

### How You Work With It

Every use of `ServerTextControl` follows the same pattern:

- **Create and initialize.** Create an instance and call [Create](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/create-method/llms-full.txt) before you use any other member. A `using` statement disposes the instance and releases its resources when the work is done.
- **Build or load the document.** [Load](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/load-method/llms-full.txt) replaces the complete contents with a document. New text and tables are inserted at the current input position, like the cursor in a word processor, and the [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/llms-full.txt) class applies character and paragraph formatting.
- **Save the result.** [Save](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/save-method/llms-full.txt) writes the complete document in the format you pass.

The format enumeration depends on where the data comes from or goes to:

| Source or target | Format enumeration |
|---|---|
| File path or `FileStream` | [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) |
| Byte array | [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/binarystreamtype/enumeration/llms-full.txt) |
| String | [StringStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/stringstreamtype/enumeration/llms-full.txt) |

[LoadSettings](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/loadsettings/llms-full.txt) and [SaveSettings](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/savesettings/llms-full.txt) pass additional options, for example to import the fields of a Word template, to write PDF metadata or to sign a PDF. [Supported File Formats](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/file-formats/llms-full.txt) lists the formats you can load and save.

### Example

A console application that creates a document and saves it as DOCX and PDF needs only a few lines: create the instance, call `Create`, set the text and call `Save` twice with `StreamType.WordprocessingML` and `StreamType.AdobePDF`. [Write the Code](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/first-application/#write-the-code) in Create Your First Application shows it, and [Use ServerTextControl in ASP.NET Core](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/first-application/#use-servertextcontrol-in-asp-net-core) saves the document to a byte array and returns it from a controller.

### Key Members

| Member | Purpose |
|---|---|
| [Create](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/create-method/llms-full.txt) | Initializes the resources of a new instance. It must be called before the object is used. |
| [Load](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/load-method/llms-full.txt) | Loads a document in a certain format and replaces the complete contents. |
| [Append](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/append-method/llms-full.txt) | Loads a document from a file, a byte array or a string and appends it to the existing document. |
| [Save](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/save-method/llms-full.txt) | Saves the complete document in the specified format. |
| [Text](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/text-property/llms-full.txt) | Gets or sets the text of the document. |
| [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/selection-property/llms-full.txt) | Gets or sets the current selection, which is used to insert text and to apply character and paragraph formatting. |
| [Tables](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/tables-property/llms-full.txt) | The tables of the document. |
| [Images](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/images-property/llms-full.txt) | The images in the main text of the document. |
| [HeadersAndFooters](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/headersandfooters-property/llms-full.txt) | The headers and footers of the document. |
| [ApplicationFields](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/applicationfields-property/llms-full.txt) | Fields such as MS Word merge fields. `LoadSettings.ApplicationFieldFormat` must be set before loading, otherwise the collection is empty. |
| [FormFields](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/formfields-property/llms-full.txt) | The form fields of the document. |
| [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/comments-property/llms-full.txt) | The comments of the document. |
| [TrackedChanges](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/trackedchanges-property/llms-full.txt) | The tracked changes in the active part of the document. |
| [SignatureFields](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/signaturefields-property/llms-full.txt) | The signature fields in the main text of the document. |
| [EntryAssembly](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/entryassembly-property/llms-full.txt) | A static property that sets the assembly which licenses `ServerTextControl`, for example a class library. By default, this is the application's executable assembly. |

The [ServerTextControl](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/servertextcontrol/llms-full.txt) reference lists all members. [License Configuration](https://docs.textcontrol.com/tx-text-control-dotnet-server/installation/licensing/llms-full.txt) explains how the license reaches your application.

### Next Steps

- [Create Your First Application](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/document-processing/first-application/llms-full.txt) — install the package and create your first DOCX and PDF.
- [Document Processing](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-processing/llms-full.txt) — creating, loading, saving and changing documents in detail.
- [PDF Processing](https://docs.textcontrol.com/tx-text-control-dotnet-server/getting-started/pdf/llms-full.txt) — create, import and digitally sign PDF documents.
- [MailMerge](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/mailmerge/llms-full.txt) — merge data into templates with a `ServerTextControl`.

---

## Nearby

- **Previous:** [Document Viewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/document-viewer/llms-full.txt)
- **Next:** [MailMerge](https://docs.textcontrol.com/tx-text-control-dotnet-server/overview/components/mailmerge/llms-full.txt)
