Getting Started: Document Editor with ASP.NET Core
This article shows how to use the TX Text Control ASP.NET document editor within a .NET 6 application in Visual Studio 2022.

Prerequisites
There are two ways to evaluate the TX Text Control Document Editor. You can either host your own backend by downloading the trial version of TX Text Control .NET Server, or by creating a trial access token to use a hosted backend, valid for 30 days:
- Download Trial Version
Setup download and installation required.- Create Trial Access Token
No download and local installation required.
Creating the Application
Make sure that you downloaded the latest version of Visual Studio 2022 that comes with the .NET 6 SDK.
-
In Visual Studio 2022, create a new project by choosing Create a new project.
-
Select ASP.NET Core Web App (Model-View-Controller) as the project template and confirm with Next.
-
Choose a name for your project and confirm with Next.
-
In the next dialog, choose .NET 6 (Long-term support) as the Framework and confirm with Create.

Adding the NuGet Package
-
In the Solution Explorer, select your created project and choose Manage NuGet Packages... from the Project main menu.
Package Source
Select either Text Control Offline Packages or nuget.org as the Package source. Packages in the official Text Control NuGet profile are frequently updated.
In case you are using a Trial Access Token, please choose nuget.org.
Browse for txtextcontrol.web and Install the latest version of the TXTextControl.Web package.

Configure the Application
Trial Access Token Users
In case you are using a Trial Access Token, skip step 6 and continue with step 7.
-
Open the Program.cs file located in the project's root folder.
At the very top of the file, insert the following code:
using TXTextControl.Web;Add the following code after the entry
app.UseStaticFiles();:// enable Web Sockets app.UseWebSockets(); // attach the Text Control WebSocketHandler middleware app.UseTXWebSocketMiddleware();
Adding the Control to the View
-
Find the Index.cshtml file in the Views -> Home folder. Replace the complete content with the following code to add the document editor to the view:
@using TXTextControl.Web.MVC @{ var sDocument = "<html><body><p>Welcome to <strong>Text Control</strong></p></body></html>"; } @Html.TXTextControl().TextControl(settings => { settings.UserNames = new string[] { "Tim Typer" }; }).LoadText(sDocument, TXTextControl.Web.StringStreamType.HTMLFormat).Render() <input type="button" onclick="insertTable()" value="Insert Table" /> <script> function insertTable() { TXTextControl.tables.add(5, 5, 10, function(e) { if (e === true) { // if added TXTextControl.tables.getItem(function(table) { table.cells.forEach(function(cell) { cell.setText("Cell text"); }); }, null, 10); } }) } </script>Trial Access Token Users
In case you are using a Trial Access Token, replace the content with the following code.
@using TXTextControl.Web.MVC @Html.TXTextControl().TextControl(settings => { settings.WebSocketURL = "wss://backend.textcontrol.com/api/TXWebSocket?access-token=addYourTokenHere" }).Render()Replace addYourTokenHere with your actual Trial Access Token.
Compile and start the application.
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.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
ASP.NETASP.NET CoreGetting Started
Getting Started: Document Editor with ASP.NET Core
This article shows how to use the TX Text Control ASP.NET document editor within a .NET 6 application in Visual Studio 2022.
ASP.NETASP.NET CoreDigital Signatures
Why Digitally Signing your PDFs is the Only Reliable Way to Prevent Tampering
PDF documents are widely used for sharing information because of their fixed layout and cross-platform compatibility. However, it is crucial to ensure the integrity and authenticity of these…
PDF/UA vs. PDF/A-3a: Which Format Should You Use for Your Business Application?
In this blog post, we will explore the differences between PDF/UA and PDF/A-3a, helping you choose the right format for your business needs. We will discuss the key features, benefits, and use…
Validating PDF/UA Documents in .NET C#
Creating accessible and compliant PDF documents is becoming an increasingly important requirement across industries. In this blog post, we explore how to validate PDF/UA documents using Text…
Bringing MailMerge Power to Markdown: Fluid Placeholders in TX Text Control…
The latest beta version of the TX Text Control Markdown NuGet package introduces support for fluid placeholders, also known as Mustache or Handlebars syntax. This powerful feature enables…
