Visual Studio Code (VS Code) is a free, lightweight, open source code editor developed by Microsoft. It supports multiple programming languages, including JavaScript, Python, C#, and many others, and runs on Windows, MacOS, and Linux.

In this tutorial, you will learn how to create a new .NET console application using .NET 8 or later and how to use the ServerTextControl TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
to create a PDF file.

Prerequisites

To follow this tutorial, you need to have the following software installed:

  • Visual Studio Code (VS Code)
  • .NET 8 or later

TX Text Control NuGet Packages

To use TX Text Control, you must have access to the TX Text Control NuGet packages. Currently, you need to install the setup (full or trial) to get the NuGet packages installed locally. The setup is available for Windows only, but the NuGet packages can be copied to your preferred system and hosted in your own NuGet package repository, such as Azure Artifacts.

Use the following link to download your own copy of the TX Text Control trial setup.

Download Trial

Create a new .NET console application

To create a new .NET console application, follow these steps:

  1. Open Visual Studio Code.
  2. Open the integrated terminal (View > Terminal).
  3. Run the following command to create a new .NET console application:

    dotnet new console -n MyTextControlApp
  4. Change to the project directory:

    cd MyTextControlApp
  5. Open the project in Visual Studio Code:

    code .

Adding NuGet.config

To use the TX Text Control NuGet packages, you need to add a NuGet.config file to your project. This file contains the configuration for NuGet package sources.

To add the NuGet.config file, follow these steps:

  1. In the root directory of your project, create a new file named NuGet.config.
  2. Add the following content to the NuGet.config file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <packageSources>
    <add key="TextControlLocal" value="C:\Program Files (x86)\Text Control GmbH\NuGetPackages" />
    </packageSources>
    </configuration>
    view raw test.xml hosted with ❤ by GitHub

    Your NuGet Source

    Replace the value of the value attribute with the path to your local NuGet packages. This can be a local folder or a URL to your own NuGet package repository. The example above uses the default TX Text Control Offline NuGet package source.

  3. Save the NuGet.config file.

Adding the TX Text Control NuGet packages

To add the TX Text Control NuGet packages to your project, follow these steps:

  1. In the integrated terminal, run the following command to add the TX Text Control NuGet packages:

    dotnet add package TXTextControl.TextControl.Core.SDK

Creating a PDF file

To create a PDF file using the ServerTextControl TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
, follow these steps:

  1. Open the Program.cs file in your project.
  2. Replace the existing code with the following code:

    using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
    {
    tx.Create();
    tx.Text = "This is a sample document.";
    tx.Save("sample.pdf", TXTextControl.StreamType.AdobePDF);
    }
    view raw test.cs hosted with ❤ by GitHub
  3. Save the Program.cs file.

Running the application

To run the application and create the PDF file, follow these steps:

  1. In the integrated terminal, run the following command:

    dotnet run
  2. After running the application, you should see a new PDF file named sample.pdf in the project directory.

Conclusion

In this tutorial, you learned how to create a new .NET console application using .NET 8 or later and how to use the ServerTextControl TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
to create a PDF file.

Now you can use the TX Text Control SDK to create and manipulate documents in your .NET applications.