Products Technologies Demo Docs Blog Support Company

Getting Started: Document Editor with ASP.NET Core and Docker Support with Linux Containers

This article shows how to create a simple ASP.NET Core application using the Document Editor and deploy it in a Docker container on Linux. The article shows how to use the NuGet packages and how to deploy the Web server in a Docker container.

Getting Started: Document Editor with ASP.NET Core and Docker Support with Linux Containers

Prerequisites

You need to download and install the trial version of TX Text Control .NET Server to host the Document Editor backend:

Introduction

This tutorial shows how to create a simple ASP.NET Core web application that hosts the TX Text Control .NET Server backend. The backend is used to render and edit documents in the browser using the TX Text Control Document Editor.

Container and Linux Distributions

TX Text Control supports most popular Linux distributions and can be run in VMs, Docker containers, or any hyperscaler environment such as Azure App Services, AWS Elastic Beanstalk, or Google Cloud Run. This tutorial shows how to create an ASP.NET Core Web application that hosts the TX Text Control in a standard Linux container using the default Visual Studio template.

Creating the Application

Make sure that you downloaded the latest version of Visual Studio 2022 that comes with the .NET 8 SDK.

  1. In Visual Studio 2022, create a new project by choosing Create a new project.

  2. Select ASP.NET Core Web App (Model-View-Controller) as the project template and confirm with Next.

  3. Enter a project name and choose a location to save the project. Confirm with Next.

  4. Choose .NET 8.0 (Long Term Support) as the Framework.

  5. Enable the Enable container support checkbox and choose Linux as the Container OS.

  6. Choose Dockerfile for the Container build type option and confirm with Create.

    Creating the .NET 8 project

Adding the Web Server Backend

  1. Create a new class by right-clicking the project in the Solution Explorer and choose Add -> Class.... Name the class TXWebServerProcess.cs and confirm with Add. Replace the complete content with the following code:

  2. Now right-click the project in the Solution Explorer and choose Add -> Existing Item.... Navigate to the installation folder of TX Text Control .NET Server:

    C:\Program Files\Text Control GmbH\TX Text Control 33.0.NET Server for ASP.NET\Assembly\net8.0

    Set the file filter to All Files (*.*) and select the following files:

    • TXTextControl.Web.Server.Core.deps.json
    • TXTextControl.Web.Server.Core.dll
    • TXTextControl.Web.Server.Core.Process.deps.json
    • TXTextControl.Web.Server.Core.Process.dll
    • TXTextControl.Web.Server.Core.Process.runtimeconfig.json
    • TXTextControl.Web.Server.Core.runtimeconfig.json
    • TXTextControl.Web.Server.Core.config.json

    Confirm with Add.

  3. Select the added files in the Solution Explorer and set the Copy to Output Directory property to Copy always.

Adding the NuGet Packages

  1. In the Solution Explorer, select your created project and choose Manage NuGet Packages... from the Project main menu. Select Text Control Offline Packages as the Package source.

    Install the following packages:

    • TXTextControl.Web
    • TXTextControl.TextControl.Core.SDK

    ASP.NET Core Web Application

Configure the Application

  1. Open the Program.cs file located in the project's root folder.

    After builder.Services.AddControllersWithViews();, add the following code:

    At the very top of the file, insert the following code:

    Add the following code after the entry app.UseStaticFiles();:

    The overall Program.cs file should look like this:

Adding the Control to the View

  1. 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:

Starting the Application

We will use the Dockerfile as is and use the default Visual Studio template using a Linux container from the official Docker Hub repository.

  1. Start the application by pressing F5 or by choosing Debug -> Start Debugging from the main menu.

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 CoreDocker

Announcing the Official DS Server Docker Image on Docker Hub

The official DS Server Docker image is now available on Docker Hub. This makes it easier to deploy the DS server in a containerized environment and manage and scale your applications. Based on the…


ASP.NETASP.NET CoreDocument Editor

Introducing TXTextControl.Web.Server.Core: A Cross-Platform Backend for TX…

With the release of TX Text Control 33.0, we are excited to introduce TXTextControl.Web.Server.Core, a major upgrade in the way the document editor works on the backend. This article provides an…


ASP.NETASP.NET CoreDocker

Using TX Text Control with Ultra-Minimal Chiseled Linux Containers

This article shows how to create ultra-lightweight, chiseled Linux containers for ASP.NET Core applications using TX Text Control .NET Server 33.0.


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 CoreDOCX

Convert MS Word DOCX to PDF including Text Reflow using .NET C# on Linux

This article explains how to use TX Text Control .NET Server to convert a Microsoft Word DOCX document to a PDF file on a Linux system using .NET C#. This conversion process includes text reflow,…