Products Technologies Demo Docs Blog Support Company

DS Server: Using DocumentViewer in Angular Applications

This quickstart tutorial shows how to use the DocumentViewer of DS Server in Angular applications.

DS Server: Using DocumentViewer in Angular Applications

This quickstart tutorial shows how to use the DocumentProcessing.DocumentViewer in an Angular application.

Prerequisites

  1. Create your free trial token here:

    Create trial token

  2. Install Node.js® and npm, if not done before.

  3. Open a Command Prompt and install the Angular CLI globally by typing in the following command:

    npm install -g @angular/cli

Creating the Project

  1. Open a Command Prompt and create a new project and default app by typing in the following command:

    ng new my-ds-viewer-app

    Follow the questions in the command prompt by answering them with "y" to add Angular routing and Enter to confirm CSS as your preferred stylesheet format.

  2. Change into the created folder by typing in the following command:

    cd my-ds-viewer-app
  3. Install the DS Server DocumentViewer package by typing in the following command:

    ng add @txtextcontrol/tx-ng-ds-document-viewer
  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.html, add the following code and save it. Replace the oauthClientID and the oauthClientSecret values with your private trial token keys you created at the beginning of this tutorial.

    <tx-ds-document-viewer
       width="1280px"
       height="1024px"
       serviceURL="https://trial.dsserver.io"
       documentData="SGVsbG8gdGhlcmU="
       oauthClientID="dsserver.PdRpDAnzGLRrTPhRnYBU2UAEkzyB4PQ1"
       oauthClientSecret="HgpGyqoFQOVkrzk6ukHtSxUS6XdU39LP">
    </tx-ds-document-viewer>
  6. Open the file src -> app -> app.module.ts and replace the complete file with the following code to import the required HttpClientModule:

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    
    import { AppRoutingModule } from './app-routing.module';
    import { AppComponent } from './app.component';
    import { DocumentViewerModule } from '@txtextcontrol/tx-ng-ds-document-viewer';
    import { HttpClientModule } from '@angular/common/http';
    
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule,
        AppRoutingModule,
        DocumentViewerModule,
        HttpClientModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
  7. Back in the command prompt, start the Angular application by typing in the following command:

    ng serve --open

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Angular

Integrate document processing, editing, sharing, collaboration, creation, electronic signatures, and PDF generation into your Angular Web applications.

Learn more about Angular

Related Posts

AngularASP.NETDocumentViewer

DocumentViewer: Deploying Forms

This sample shows how to deploy a form with form fields using the DocumentViewer in order to collect the completed data.


AngularASP.NETDS Server

Version 30.0 Live Preview

Still in early beta, we published a live demo that shows some of the new features of TX Text Control 30.0 including comments and the new online document editor ribbon style.


AngularASP.NETDS Server

TX Text Control 30.0 Preview: Improved Online Document Editor Ribbon Design

We are currently working on version 30.0 that is planned to be released in Q4 2021. In this new version, the online document editor will receive an improved ribbon design and additional sidebars.…


AngularASP.NETCollaboration

DocumentViewer 29.2 (29.0.302.500) Final Released

We are happy to announce the final release of version 29.2 of the DocumentViewer for ASP.NET and ASP.NET Core. It comes with many new annotation and form field features to deploy documents for…


ASP.NETDocumentViewerDS Server

DocumentViewer Pre-Release: UI Improvements and Events

We published another pre-release version of the TX Text Control DocumentViewer that includes UI improvements and event handling for specific events. This article gives an overview of the latest…