# Getting Started: Document Viewer with ASP.NET Core and Linux WSL Support

> In this article, we will create a simple document viewer application using the Document Viewer component from the TX Text Control .NET Server product. We will use ASP.NET Core and run the application on Linux using Windows Subsystem for Linux (WSL).

- **Author:** Bjoern Meyer
- **Published:** 2025-03-12
- **Modified:** 2025-11-16
- **Description:** In this article, we will create a simple document viewer application using the Document Viewer component from the TX Text Control .NET Server product. We will use ASP.NET Core and run the application on Linux using Windows Subsystem for Linux (WSL).
- **3 min read** (453 words)
- **Tags:**
  - ASP.NET Core
  - Document Viewer
  - Linux
  - WSL
- **Web URL:** https://www.textcontrol.com/blog/2025/03/12/getting-started-document-viewer-with-asp-net-core-and-linux-wsl-support/
- **LLMs URL:** https://www.textcontrol.com/blog/2025/03/12/getting-started-document-viewer-with-asp-net-core-and-linux-wsl-support/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2025/03/12/getting-started-document-viewer-with-asp-net-core-and-linux-wsl-support/llms-full.txt

---

> ### Prerequisites
> 
> You need to download and install the trial version of TX Text Control .NET Server to host the required backend:
> 
> - [Download Trial Version](https://www.textcontrol.com/product/tx-text-control-dotnet-server/download/)  
>     Setup download and installation required.

### Creating the Application

Make sure that you downloaded the latest version of Visual Studio 2022 that comes with the [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0).

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. Choose a name for your project and confirm with *Next*.
4. In the next dialog, choose *.NET 8 (Long Term Support)* as the *Framework* and confirm with *Create*.
    
    ![Creating the .NET 8 project](https://s1-www.textcontrol.com/assets/dist/blog/2025/03/12/d/assets/visualstudio1.webp "Creating the .NET 8 project")

#### Adding the NuGet Packages

5. 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.DocumentViewer**
    - **TXTextControl.TextControl.Core.SDK**
    
    ![ASP.NET Core Web Application](https://s1-www.textcontrol.com/assets/dist/blog/2025/03/12/d/assets/visualstudio2.webp "ASP.NET Core Web Application")

#### Adding the Control to the View

6. Find the *Index.cshtml* file in the *Views -> Home* folder. Replace the complete content with the following code to add the document viewer to the view:
    
    ```
    @using TXTextControl.Web.MVC.DocumentViewer
    @using System.Text
    
    <div style="width: 800px; height: 600px;">
    
    @Html.TXTextControl().DocumentViewer(settings => {
        settings.DocumentData = Convert.ToBase64String(
    	Encoding.ASCII.GetBytes("<strong>Sample Content</strong>"));
        settings.Dock = DocumentViewerSettings.DockStyle.Fill;
    }).Render()
    
    </div>
    
    <script>
    
        var jsonAnnotations = '[[{"pen":{"type":"comment","objectWidth":32,"objectHeight":32},"user":"Unknown User","location":{"x":127,"y":50},"time":1658908087097,"comments":[{"comment":"Welcome to Text Control","user":"Unknown User","date":1658908100339,"id":"c8d818ce-ff1e-4c0c-b78c-6ba95a98dede","status":"none"}],"id":"feed80ff-1c94-4abf-9838-3e833faa4092","status":"Accepted"}]]';
    
        window.addEventListener("documentViewerLoaded", function () {
    	TXDocumentViewer.annotations.showToolbar(true);
    	TXDocumentViewer.annotations.load(jsonAnnotations);
        });
    
    </script>
    ```

#### Starting the Application

7. Select *WSL* as the startup profile and start the application.
    
    ![Starting the application](https://s1-www.textcontrol.com/assets/dist/blog/2025/03/12/d/assets/wsl.webp "Starting the application")

#### Enable WSL (Windows Subsystem for Linux)

In case you haven't enabled WSL yet, follow these steps:

> **Enable WSL (Windows Subsystem for Linux)**
> 
> 1. Open PowerShell as an administrator.
> 2. Run the following command:
>     
>     ```
>     wsl --install
>     ```
>     
>     This installs the default Linux distribution (usually Ubuntu) and enables necessary features.
> 3. After the installation, restart your computer.
> 
> **Set WSL 2 as the Default Version**
> 
> To set WSL 2 as the default version, follow these steps:
> 
> 1. Open PowerShell as an administrator.
> 2. Run the following command:
>     
>     ```
>     wsl --set-default-version 2
>     ```
> 3. If you haven’t installed a Linux distribution yet, you can do so via:
>     
>     ```
>     wsl --install -d Ubuntu
>     ```

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Getting Started: Document Editor with ASP.NET Core and Linux WSL Support](https://www.textcontrol.com/blog/2025/03/12/getting-started-document-editor-with-asp-net-core-and-linux-wsl-support/llms.txt)
- [Document Editor with TX Spell .NET on Linux using ASP.NET Core](https://www.textcontrol.com/blog/2026/01/28/document-editor-tx-spell-net-linux-aspnet-core/llms.txt)
- [High-Performance Text Replacement in Large DOCX Files using C# .NET](https://www.textcontrol.com/blog/2025/07/30/high-performance-text-replacement-in-large-docx-files-using-csharp-dotnet/llms.txt)
- [Document Viewer 33.2.1 Released: New Event and Bug Fixes](https://www.textcontrol.com/blog/2025/07/30/document-viewer-33-2-1-released-new-event-and-bug-fixes/llms.txt)
- [Convert MS Word DOCX to PDF including Text Reflow using .NET C# on Linux](https://www.textcontrol.com/blog/2025/06/10/convert-ms-word-docx-to-pdf-including-text-reflow-using-dotnet-csharp-on-linux/llms.txt)
- [Announcing the Official DS Server Docker Image on Docker Hub](https://www.textcontrol.com/blog/2025/05/02/announcing-the-official-ds-server-docker-image-on-docker-hub/llms.txt)
- [Introducing DS Server 4.0: Linux-Ready and Container-Friendly](https://www.textcontrol.com/blog/2025/04/30/introducing-ds-server-4-linux-ready-and-container-friendly/llms.txt)
- [Creating a .NET Console Application with Visual Studio Code and TX Text Control (on Linux)](https://www.textcontrol.com/blog/2025/04/03/creating-a-dotnet-console-application-with-visual-studio-code-and-tx-text-control-on-linux/llms.txt)
- [TX Text Control Core vs. Classic Performance Comparison Plain Text to DOCX and PDF](https://www.textcontrol.com/blog/2025/03/31/2025-03-31-tx-text-control-core-vs-classic-performance-comparison-plain-text-to-docx-and-pdf/llms.txt)
- [Building an ASP.NET Core Backend (Linux and Windows) for the Document Editor and Viewer](https://www.textcontrol.com/blog/2025/03/26/building-an-asp-net-core-backend-for-the-document-editor-and-viewer/llms.txt)
- [TX Text Control Document Editor and Viewer for Blazor Released](https://www.textcontrol.com/blog/2025/03/25/tx-text-control-document-editor-and-viewer-for-blazor-released/llms.txt)
- [Getting Started: Document Viewer for Blazor in ASP.NET Core](https://www.textcontrol.com/blog/2025/03/25/getting-started-document-viewer-for-blazor-in-asp-net-core/llms.txt)
- [How to Create PDF Documents with TX Text Control using C# .NET on Linux](https://www.textcontrol.com/blog/2025/03/18/how-to-create-pdf-documents-with-tx-text-control-using-c-sharp-net-on-linux/llms.txt)
- [Benchmarking TX Text Control: Classic vs. Core on Windows and Linux](https://www.textcontrol.com/blog/2025/03/14/benchmarking-tx-text-control-classic-vs-core-on-windows-and-linux/llms.txt)
- [Introducing TXTextControl.Web.Server.Core: A Cross-Platform Backend for TX Text Control Document Editor](https://www.textcontrol.com/blog/2025/03/13/introducing-txtextcontrol-web-server-core-a-cross-platform-backend-for-tx-text-control-document-editor/llms.txt)
- [Using TX Text Control with Ultra-Minimal Chiseled Linux Containers](https://www.textcontrol.com/blog/2025/03/12/using-tx-text-control-with-ultra-minimal-chiseled-linux-containers/llms.txt)
- [Getting Started: Document Editor with ASP.NET Core and Docker Support with Linux Containers](https://www.textcontrol.com/blog/2025/03/12/getting-started-document-editor-with-asp-net-core-and-docker-support-with-linux-containers/llms.txt)
- [Version 33.0 Preview: NuGet Packages Explained and Why we Minimize Dependencies](https://www.textcontrol.com/blog/2025/02/24/version-33-0-preview-nuget-packages-explained-and-why-we-minimize-dependencies/llms.txt)
- [Announcing Our Work on a Blazor Component for Document Editing and Viewing](https://www.textcontrol.com/blog/2025/01/24/announcing-our-work-on-a-blazor-component-for-document-editing-and-viewing/llms.txt)
- [TX Text Control Linux Preview: Font Handling](https://www.textcontrol.com/blog/2024/12/28/tx-text-control-linux-preview-font-handling/llms.txt)
- [TX Text Control for Linux Preview: Document Processing in ASP.NET Core on Azure App Services](https://www.textcontrol.com/blog/2024/12/17/tx-text-control-for-linux-preview-document-processing-in-asp-net-core-on-azure-app-services/llms.txt)
- [Hello Linux! Almost There - A Game-Changer for Document Processing](https://www.textcontrol.com/blog/2024/12/12/hello-linux-almost-there-a-game-changer-for-document-processing/llms.txt)
- [Preparing Documents for E-Signing for Multiple Signers in .NET C#](https://www.textcontrol.com/blog/2024/11/13/preparing-documents-for-e-signing-for-multiple-signers-in-net-c-sharp/llms.txt)
- [ASP.NET Core: Use the Document Editor and Viewer in the Same Razor View](https://www.textcontrol.com/blog/2024/11/08/asp-net-core-use-the-document-editor-and-viewer-in-the-same-razor-view/llms.txt)
- [Optimizing Digital Signature Workflows: Starting with MS Word DOCX Files Instead of PDFs in C#](https://www.textcontrol.com/blog/2024/09/27/optimizing-digital-signature-workflows-starting-with-ms-word-docx-files-instead-of-pdfs-in-csharp/llms.txt)
