# Getting Started: Document Viewer with Angular CLI v18.0

> This article shows how to use the TX Text Control Document Viewer npm package for Angular within an Angular CLI v18.0 application. It uses the trial backend running on our servers, but can also be used to get started with self-hosted applications.

> **Note:** This article is outdated and may no longer be accurate.

- **Author:** Bjoern Meyer
- **Published:** 2024-11-15
- **Modified:** 2025-11-16
- **Description:** This article shows how to use the TX Text Control Document Viewer npm package for Angular within an Angular CLI v18.0 application. It uses the trial backend running on our servers, but can also be used to get started with self-hosted applications.
- **3 min read** (505 words)
- **Tags:**
  - Angular
  - JavaScript
  - Document Viewer
  - Angular v18
- **LLMs.txt URL:** https://www.textcontrol.com/blog/2024/11/15/getting-started-document-viewer-with-angular-cli-v18-0/llms.txt
- **LLMs-full.txt URL:** https://www.textcontrol.com/blog/2024/11/15/getting-started-document-viewer-with-angular-cli-v18-0/llms-full.txt
- **Canonical URL:** https://www.textcontrol.com/blog/2024/11/15/getting-started-document-viewer-with-angular-cli-v18-0/

---

The frequency of Angular releases is high compared to new major releases of .NET. Generally, a major release comes every 6 months and the average [support window](https://angular.io/guide/releases) for major releases is 18 months. Thus, Angular version and application updates are a very typical task for Angular developers.

In order to be compatible with a wider range of releases, we have chosen not to build our packages directly against the latest release. Our components can be installed ignoring peer dependencies and are compatible with the latest version.

> ### Prerequisites
> 
> There are two ways to evaluate TX Text Control Document Viewer. Either host your own backend by downloading the TX Text Control .NET Server trial, or create a 30-day trial access token to use a hosted backend:
> 
> - [Download Trial Version](https://www.textcontrol.com/product/tx-text-control-dotnet-server/)  
>     Setup download and installation required.
> - [Create Trial Access Token](https://www.textcontrol.com/product/client-package/token/)  
>     No download and local installation required.

### Creating the Angular Application

This tutorial shows how to create your first Angular application using the TX Text Control document editor.

#### Prerequisites

1. Create your free trial access token here:
    
    [Create Access Token](https://www.textcontrol.com/product/client-package/token/)
2. Install [Node.js](https://nodejs.org/en/download/) and npm, if not done before.
3. Open a Command Prompt and install the [Angular CLI](https://github.com/angular/angular-cli) globally by typing in the following command:
    
    ```
    npm install -g @angular/cli
    ```

This tutorial uses Visual Studio Code that can be [downloaded](https://code.visualstudio.com/) for free.

#### Creating the Angular Project

1. Open a Command Prompt and create a new project and default app by typing in the following command:
    
    ```
    ng new my-viewer-app
    ```
    
    Follow the questions in the command prompt by confirming *CSS* as your preferred stylesheet format and 'N' to disable Server-Side Rendering and Static Site Generation.
2. Change into the created folder by typing in the following command:
    
    ```
    cd my-viewer-app
    ```
3. Install the TX Text Control Document Viewer package by typing in the following command:
    
    ```
    npm i @txtextcontrol/tx-ng-document-viewer --legacy-peer-deps
    ```
4. Open this folder in Visual Studio Code by typing in the following command:
    
    ```
    code .
    ```
5. In Visual Studio Code, open the file *src -> app -> app.component.ts*, add replace the complete content with the following code and save it:
    
    ```
    import { Component } from '@angular/core';
    import { RouterOutlet } from '@angular/router';
    import { DocumentViewerModule } from '@txtextcontrol/tx-ng-document-viewer';
    
    @Component({
    selector: 'app-root',
    standalone: true,
    imports: [RouterOutlet, DocumentViewerModule],
    templateUrl: './app.component.html',
    styleUrl: './app.component.css'
    })
    export class AppComponent {
    title = 'my-viewer-app';
    }
    ```
6. Open the file *src -> app -> app.component.html*, add replace the complete content with the following code, replace *yourtoken* with your given [Trial Access Token](https://www.textcontrol.com/product/client-package/token/) and save it:
    
    ```
    <tx-document-viewer
    width="800px"
    height="800px"
    basePath="https://backend.textcontrol.com?access-token=yourtoken"
    documentData="SGVsbG8gdGhlcmU="
    dock="Window"
    [toolbarDocked]="true"
    documentPath="test.docx"
    [isSelectionActivated]="true"
    [showThumbnailPane]="true">
    </tx-document-viewer>
    ```
    
    > **Backend Server**
    > 
    > The code above uses a hosted demo backend server specified by the *basePath* property. If you are hosting your own required backend server, replace the URL with your backend endpoint.
7. Back in the command prompt, start the Angular application by typing in the following command:
    
    ```
    ng serve --open
    ```

---

## 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 Viewer Version 33.0 with Angular CLI 19.0](https://www.textcontrol.com/blog/2025/03/18/getting-started-document-viewer-version-33-0-with-angular-cli-19-0/llms.txt)
- [Document Viewer for Angular: SignatureSettings Explained](https://www.textcontrol.com/blog/2024/03/20/signaturesettings-explained/llms.txt)
- [Building an ASP.NET Core Backend Application to Host the Document Editor and Document Viewer](https://www.textcontrol.com/blog/2024/03/14/building-an-asp-net-core-backend-application-to-host-the-document-editor-and-document-viewer/llms.txt)
- [Getting Started: Document Viewer with Angular CLI](https://www.textcontrol.com/blog/2023/02/02/getting-started-document-viewer-with-angular-cli/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)
- [Getting Started: Document Editor Version 33.0 with Angular CLI 19.0](https://www.textcontrol.com/blog/2025/03/18/getting-started-document-editor-version-33-0-with-angular-cli-19-0/llms.txt)
- [Using the Document Editor in SPA Applications using the removeFromDom Method](https://www.textcontrol.com/blog/2024/09/02/using-the-document-editor-in-spa-applications-using-the-removefromdom-method/llms.txt)
- [Getting Started Video Tutorial: How to use the Document Viewer in Angular](https://www.textcontrol.com/blog/2024/08/05/getting-started-video-tutorial-how-to-use-the-document-viewer-in-angular/llms.txt)
- [Observe When the Reporting Preview Tab is Active Using MutationObserver](https://www.textcontrol.com/blog/2024/07/23/observe-when-the-reporting-preview-tab-is-active-using-mutationobserver/llms.txt)
- [Handling Form Field Data in Angular Applications](https://www.textcontrol.com/blog/2024/03/27/handling-form-field-data-in-angular-applications/llms.txt)
- [Preparing Forms for the Document Viewer and Customizing the Signing Process in Angular and ASP.NET Core](https://www.textcontrol.com/blog/2024/03/25/preparing-forms-for-the-document-viewer-and-customizing-the-signing-process-in-angular-and-asp-net-core/llms.txt)
- [Asynchronous Loading and Saving in Angular Document Editor with an ASP.NET Core Web API](https://www.textcontrol.com/blog/2024/03/21/asynchronous-loading-and-saving-in-angular-document-editor-with-an-asp-net-core-web-api/llms.txt)
- [How to Add Electronic and Digital Signatures to PDFs in ASP.NET Core C# and Angular](https://www.textcontrol.com/blog/2024/03/20/how-to-add-electronic-and-digital-signatures-to-pdfs-in-asp-net-core-c-sharp-and-angular/llms.txt)
- [Customizing Electronic Signature Fonts for Typed Signatures in Angular and ASP.NET Core](https://www.textcontrol.com/blog/2024/03/11/customizing-electronic-signature-fonts-for-typed-signatures-in-angular-and-asp-net-core/llms.txt)
- [Getting Started: Document Editor with Angular CLI v17.0](https://www.textcontrol.com/blog/2023/12/13/getting-started-document-editor-with-angular-cli-17/llms.txt)
- [Getting Started: Document Viewer with JavaScript](https://www.textcontrol.com/blog/2023/09/15/getting-started-document-viewer-with-javascript/llms.txt)
- [Angular: Loading Documents from Assets Folder on Initialization](https://www.textcontrol.com/blog/2023/07/10/angular-loading-documents-from-assets-folder-on-initialization/llms.txt)
- [Reuse Angular Document Editor Instances in Bootstrap Tabs](https://www.textcontrol.com/blog/2023/05/22/reuse-angular-document-editor-instances-in-bootstrap-tabs/llms.txt)
- [Preview: PDF.js Support for Form Fields, Selections and Annotations](https://www.textcontrol.com/blog/2023/04/18/preview-pdfjs-support-for-form-fields-selections-and-annotations/llms.txt)
- [Getting Started: Angular Document Editor Attributes Explained](https://www.textcontrol.com/blog/2023/02/01/getting-started-angular-document-editor-attributes-explained/llms.txt)
- [Getting Started: Programming the Angular Document Editor using JavaScript](https://www.textcontrol.com/blog/2023/01/30/getting-started-programming-the-angular-document-editor-using-javascript/llms.txt)
- [Getting Started: Loading and Saving Documents using Angular](https://www.textcontrol.com/blog/2023/01/30/loading-and-saving-documents-using-angular/llms.txt)
- [Getting Started: Document Editor with Angular CLI](https://www.textcontrol.com/blog/2023/01/30/getting-started-document-editor-with-angular-cli/llms.txt)
- [What is the Difference between Electronic and Digital Signatures?](https://www.textcontrol.com/blog/2022/10/20/what-is-the-difference-between-electronic-and-digital-signatures/llms.txt)
- [Merging Signature Annotations into Documents](https://www.textcontrol.com/blog/2022/10/19/merging-signature-annotations-into-documents/llms.txt)
