VintaSoft Imaging .NET SDK 12.4: Documentation for Web developer
In This Topic
    Add web document viewer to an Angular and ASP.NET Core application
    In This Topic
    This tutorial shows how to create a blank Angular and ASP.NET Core application in Visual Studio .NET 2022 and add document viewer (with ability to open images and documents (PDF, DOCX, XLSX), extract/search text, annotate documents) to an Angular and ASP.NET Core application.


    Here are steps, which must be done:
    1. Create a blank Angular and ASP.NET Core application.

      Open Visual Studio .NET 2022 and create a new application of "Angular and ASP.NET Core" type:

      Configure the application to use .NET 8.0:

    2. Server side: Add references to the Vintasoft assemblies to "AngularApp1.Server" project.

      Copy Vintasoft.Shared.dll, Vintasoft.Imaging.dll, Vintasoft.Imaging.Pdf.dll, Vintasoft.Imaging.Annotation.dll, Vintasoft.Imaging.Annotation.Pdf.dll, Vintasoft.Imaging.Office.OpenXml, Vintasoft.Shared.Web.dll, Vintasoft.Imaging.Web.Services.dll, Vintasoft.Imaging.Annotation.Web.Services.dll, Vintasoft.Imaging.AspNetCore.ApiControllers.dll and Vintasoft.Imaging.Annotation.AspNetCore.ApiControllers.dll assemblies from "<SdkInstallPath>\VintaSoft Imaging .NET v12.4\Bin\DotNet8\AnyCPU\" directory to the "Bin" directory of "AngularApp1.Server" project and add references to assemblies in "AngularApp1.Server" project.



    3. Server side: Specify drawing engine, which should be used by VintaSoft Imaging .NET SDK for drawing of 2D graphics.

      If "AngularApp1.Server" project must be used in Windows or Linux, SkiaSharp drawing engine should be used.
      If "AngularApp1.Server" project must be used in Windows only, System.Drawing or SkiaSharp drawing engine should be used.

      Here are steps, which should be made for using SkiaSharp engine:
      • Add reference to the Vintasoft.Imaging.Drawing.SkiaSharp.dll assembly.
      • Add reference to the SkiaSharp nuget-package version 2.88.6.
      • Open "Program.cs" file in "AngularApp1.Server" project, add code line "Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();" at the beginning of file - added code specifies that VintaSoft Imaging .NET SDK should use SkiaSharp library for drawing of 2D graphics.

      Here are steps, which should be made for using System.Drawing engine:
      • Add reference to the Vintasoft.Imaging.Gdi.dll assembly.
      • Open "Program.cs" file in "AngularApp1.Server" project, add code line "Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();" at the beginning of file - added code specifies that VintaSoft Imaging .NET SDK should use System.Drawing library for drawing of 2D graphics.

    4. Server side: Create web services, which allow to upload/download file, manage image collection, get information about images, get thumbnails, render image tiles, extract/search text and annotate document.

      • Create web service that allows to upload/download file

        • Press the right mouse button on the "Controllers" folder and select the "Add => Controller..." menu from context menu
        • Select Empty API controller template, set the controller name to the "MyVintasoftFileApiController" and press the "Add" button
        • Specify that MyVintasoftFileApiController class is derived from Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftFileApiController class

          Here are source codes of MyVintasoftFileApiController class:
          namespace AngularApp1.Server.Controllers
          {
              public class MyVintasoftFileApiController : Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftFileApiController
              {
          
                  public MyVintasoftFileApiController(IWebHostEnvironment hostingEnvironment)
                      : base(hostingEnvironment)
                  {
                  }
          
              }
          }
          
          
      • Create web service that allows to manage image collection

        • Press the right mouse button on the "Controllers" folder and select the "Add => Controller..." menu from context menu
        • Select Empty API controller template, set the controller name to the "MyVintasoftImageCollectionApiController" and press the "Add" button
        • Specify that MyVintasoftImageCollectionApiController class is derived from Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftImageCollectionApiController class

          Here are source codes of MyVintasoftImageCollectionApiController class:
          namespace AngularApp1.Server.Controllers
          {
              public class MyVintasoftImageCollectionApiController : Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftImageCollectionApiController
              {
          
                  public MyVintasoftImageCollectionApiController(IWebHostEnvironment hostingEnvironment)
                      : base(hostingEnvironment)
                  {
                  }
          
              }
          }
          
          
      • Create web service that allows to get information about images, get thumbnails, render image tiles, extract/search text

        • Press the right mouse button on the "Controllers" folder and select the "Add => Controller..." menu from context menu
        • Select Empty API controller template, set the controller name to the "MyVintasoftImageApiController" and press the "Add" button
        • Specify that MyVintasoftImageApiController class is derived from Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftImageApiController class

          Here are source codes of MyVintasoftImageApiController class:
          namespace AngularApp1.Server.Controllers
          {
              public class MyVintasoftImageApiController : Vintasoft.Imaging.AspNetCore.ApiControllers.VintasoftImageApiController
              {
          
                  public MyVintasoftImageApiController(IWebHostEnvironment hostingEnvironment)
                      : base(hostingEnvironment)
                  {
                  }
          
              }
          }
          
          
      • Create web service that allows to annotate images and documents

        • Press the right mouse button on the "Controllers" folder and select the "Add => Controller..." menu from context menu
        • Select Empty API controller template, set the controller name to the "MyVintasoftAnnotationCollectionApiController" and press the "Add" button
        • Specify that MyVintasoftAnnotationCollectionApiController class is derived from Vintasoft.Imaging.Annotation.AspNetCore.ApiControllers.VintasoftAnnotationCollectionApiController class

          Here are source codes of MyVintasoftAnnotationCollectionApiController class:
          namespace AngularApp1.Server.Controllers
          {
              public class MyVintasoftAnnotationCollectionApiController :
                  Vintasoft.Imaging.Annotation.AspNetCore.ApiControllers.VintasoftAnnotationCollectionApiController
              {
          
                  public MyVintasoftAnnotationCollectionApiController(IWebHostEnvironment hostingEnvironment)
                      : base(hostingEnvironment)
                  {
                  }
              }
          }
          
          
    5. Server side: Create CORS-policy that allows to access web services from client side.

      • Open the "Program.cs" file in "AngularApp1.Server" project and add code that:
        • Creates CORS-policy that allows to access web services from "localhost"
        • Enables CORS usage in "AngularApp1.Server" project

        Here are source codes of "Program.cs" file after update:
        Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
        
        var builder = WebApplication.CreateBuilder(args);
        
        // Add services to the container.
        
        builder.Services.AddControllers();
        
        builder.Services.AddCors(options =>
        {
            options.AddPolicy(name: "CorsPolicy1", policy =>
            {
                policy.SetIsOriginAllowed(origin => new Uri(origin).Host == "localhost").AllowAnyHeader().AllowAnyMethod();
            });
        });
        
        var app = builder.Build();
        
        app.UseDefaultFiles();
        app.UseStaticFiles();
        
        // Configure the HTTP request pipeline.
        
        app.UseHttpsRedirection();
        
        app.UseAuthorization();
        
        app.UseCors("CorsPolicy1");
        
        app.MapControllers();
        
        app.MapFallbackToFile("/index.html");
        
        app.Run();
        
        
    6. Server side: Add Newtonsoft JSON for deserialization of JSON annotations.

      • Add reference to the Microsoft.AspNetCore.Mvc.NewtonsoftJson nuget-package.

      • Open the "Program.cs" file in "AngularApp1.Server" project and add code line "builder.Services.AddControllersWithViews().AddNewtonsoftJson();" after line "builder.Services.AddControllers();". This is necessary for correct deserialization of JSON annotations.


        Here are source codes of "Program.cs" file after update:

        Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
        
        var builder = WebApplication.CreateBuilder(args);
        
        // Add services to the container.
        
        builder.Services.AddControllers();
        builder.Services.AddControllersWithViews().AddNewtonsoftJson();
        
        builder.Services.AddCors(options =>
        {
            options.AddPolicy(name: "CorsPolicy1", policy =>
            {
                policy.SetIsOriginAllowed(origin => new Uri(origin).Host == "localhost").AllowAnyHeader().AllowAnyMethod();
            });
        });
        
        var app = builder.Build();
        
        app.UseDefaultFiles();
        app.UseStaticFiles();
        
        // Configure the HTTP request pipeline.
        
        app.UseHttpsRedirection();
        
        app.UseAuthorization();
        
        app.UseCors("CorsPolicy1");
        
        app.MapControllers();
        
        app.MapFallbackToFile("/index.html");
        
        app.Run();
        
        
    7. Server side: Update launch URL in 'launchSettings.json' file.

      • Open file "Properties\launchSettings.json" in "AngularApp1.Server" and clear launch URL:
    8. Server side: Copy the default test PDF document to a server side.

      • Create folder "UploadedImageFiles\SessionID" in "AngularApp1.Server" project and copy test PDF document "<SdkInstallPath>\VintaSoft\Imaging .NET v12.4\Examples\ASP.NET Core\CSharp\AspNetCoreImagingDemo\wwwroot\UploadedImageFiles\VintasoftImagingDemo.pdf" to the folder. This document will be displayed in document viewer.
    9. Compile the project for restoring dependencies using 'npm'.

    10. Client side: Delete files, which are not necessary in this tutorial.

      • Delete files "WeatherForecast.cs" and "Controllers\WeatherForecastController.cs" in "AngularApp1.Server" project - the WeatherForecast Web API controller is not necessary in this tutorial.

      • Delete files "src\app\app.component.css", "src\app\app.component.html", "src\app\app.component.spec.ts", "src\app\app.component.ts" in "angularapp1.client" project - this Angular-component is not necessary in this tutorial.
    11. Client side: Add JavaScript files and TypeScript modules to the "angularapp1.client" project.

      • Add the "assets" folder to the "src\app\" folder in "angularapp1.client" project.

      • Copy Vintasoft.Shared.js, Vintasoft.Shared.d.ts, Vintasoft.Imaging.js, Vintasoft.Imaging.d.ts, Vintasoft.Imaging.Annotation.js, Vintasoft.Imaging.Annotation.d.ts, Vintasoft.Imaging.DocumentViewer.js and Vintasoft.Imaging.DocumentViewer.d.ts files from "<SdkInstallPath>\VintaSoft Imaging .NET v12.4\Bin\JavaScript\" folder to the "src\app\assets\" folder.

      • Specify, which "standard" dialogs (password dialog, print dialog, etc) should be used by web document viewer
        • If web document viewer should use ready-to-use "standard" Bootstrap dialogs:
          • Add "bootstrap" Node-module to the "package.json" file. Rebuild the project for refreshing Node-modules.
            Here are source codes of "package.json" file after update:
            {
              "name": "angularapp1.client",
              "version": "0.0.0",
              "scripts": {
                "ng": "ng",
                "start": "run-script-os",
                "build": "ng build",
                "watch": "ng build --watch --configuration development",
                "test": "ng test",
                "prestart": "node aspnetcore-https",
                "start:windows": "ng serve --ssl --ssl-cert \"%APPDATA%\\ASP.NET\\https\\%npm_package_name%.pem\" --ssl-key \"%APPDATA%\\ASP.NET\\https\\%npm_package_name%.key\" --host=127.0.0.1",
                "start:default": "ng serve --ssl --ssl-cert \"$HOME/.aspnet/https/${npm_package_name}.pem\" --ssl-key \"$HOME/.aspnet/https/${npm_package_name}.key\" --host=127.0.0.1"
              },
              "private": true,
              "dependencies": {
                "@angular/animations": "^18.0.0",
                "@angular/common": "^18.0.0",
                "@angular/compiler": "^18.0.0",
                "@angular/core": "^18.0.0",
                "@angular/forms": "^18.0.0",
                "@angular/platform-browser": "^18.0.0",
                "@angular/platform-browser-dynamic": "^18.0.0",
                "@angular/router": "^18.0.0",
                "bootstrap": "5.3.3",
                "rxjs": "~7.8.0",
                "tslib": "^2.3.0",
                "zone.js": "~0.14.3",
                "jest-editor-support": "*",
                "run-script-os": "*"
              },
              "devDependencies": {
                "@angular-devkit/build-angular": "^18.0.3",
                "@angular/cli": "^18.0.3",
                "@angular/compiler-cli": "^18.0.0",
                "@types/jasmine": "~5.1.0",
                "jasmine-core": "~5.1.0",
                "karma": "~6.4.0",
                "karma-chrome-launcher": "~3.2.0",
                "karma-coverage": "~2.2.0",
                "karma-jasmine": "~5.1.0",
                "karma-jasmine-html-reporter": "~2.1.0",
                "typescript": "~5.4.2"
              }
            }
            
            
          • Copy Vintasoft.Imaging.Dialogs.Bootstrap.js, Vintasoft.Imaging.Dialogs.Bootstrap.d.ts, Vintasoft.Imaging.DocumentViewer.Dialogs.Bootstrap.js and Vintasoft.Imaging.DocumentViewer.Dialogs.Bootstrap.d.ts files from "<InstallPath>\VintaSoft Imaging .NET v12.4\Bin\JavaScript\" folder into "src\app\assets\" folder.

        • If web document viewer should use ready-to-use "standard" jQuery UI dialogs:
          • Add "jquery-ui-dist" Node-module to the "package.json" file. Rebuild the project for refreshing Node-modules.
          • Copy Vintasoft.Imaging.Dialogs.jQueryUI.js, Vintasoft.Imaging.Dialogs.jQueryUI.d.ts, Vintasoft.Imaging.DocumentViewer.Dialogs.jQueryUI.js and Vintasoft.Imaging.DocumentViewer.Dialogs.jQueryUI.d.ts files from "<InstallPath>\VintaSoft Imaging .NET v12.4\Bin\JavaScript\" folder into "src\app\assets\" folder.

        • If web document viewer should use custom "standard" dialogs (for example, Angular+Bootstrap dialogs), please read how to create custom "standard" dialogs here.

      • Add references to used JavaScript libraries to the "projects => Demo => architect => build => options => scripts" section in "angular.json" file, add references to used CSS-files to the "projects => Demo => architect => build => options => styles" section in "angular.json" file.
        Here are source codes of "angular.json" file:
        {
          "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
          "version": 1,
          "newProjectRoot": "projects",
          "projects": {
            "angularapp1.client": {
              "projectType": "application",
              "schematics": {
                "@schematics/angular:component": {
                  "standalone": false
                },
                "@schematics/angular:directive": {
                  "standalone": false
                },
                "@schematics/angular:pipe": {
                  "standalone": false
                }
              },
              "root": "",
              "sourceRoot": "src",
              "prefix": "app",
              "architect": {
                "build": {
                  "builder": "@angular-devkit/build-angular:application",
                  "options": {
                    "outputPath": "dist/angularapp1.client",
                    "index": "src/index.html",
                    "browser": "src/main.ts",
                    "polyfills": [
                      "zone.js"
                    ],
                    "tsConfig": "tsconfig.app.json",
                    "assets": [
                      {
                        "glob": "**/*",
                        "input": "public"
                      }
                    ],
                    "styles": [
                      "node_modules/bootstrap/dist/css/bootstrap.css",
                      "src/Vintasoft.Imaging.css",
                      "src/Vintasoft.Imaging.DocumentViewer.css",
                      "src/styles.css"
                    ],
                    "scripts": [
                      "src/app/assets/Vintasoft.Shared.js",
                      "src/app/assets/Vintasoft.Imaging.js",
                      "src/app/assets/Vintasoft.Imaging.Annotation.js",
                      "src/app/assets/Vintasoft.Imaging.DocumentViewer.js",
                      "src/app/assets/Vintasoft.Imaging.Dialogs.Bootstrap.js",
                      "src/app/assets/Vintasoft.Imaging.DocumentViewer.Dialogs.Bootstrap.js"
                    ]
                  },
                  "configurations": {
                    "production": {
                      "budgets": [
                        {
                          "type": "initial",
                          "maximumWarning": "500kB",
                          "maximumError": "1MB"
                        },
                        {
                          "type": "anyComponentStyle",
                          "maximumWarning": "2kB",
                          "maximumError": "4kB"
                        }
                      ],
                      "outputHashing": "all"
                    },
                    "development": {
                      "optimization": false,
                      "extractLicenses": false,
                      "sourceMap": true
                    }
                  },
                  "defaultConfiguration": "production"
                },
                "serve": {
                  "builder": "@angular-devkit/build-angular:dev-server",
                  "configurations": {
                    "production": {
                      "buildTarget": "angularapp1.client:build:production"
                    },
                    "development": {
                      "buildTarget": "angularapp1.client:build:development"
                    }
                  },
                  "defaultConfiguration": "development",
                  "options": {
                    "proxyConfig": "src/proxy.conf.js"
                  }
                },
                "extract-i18n": {
                  "builder": "@angular-devkit/build-angular:extract-i18n"
                },
                "test": {
                  "builder": "@angular-devkit/build-angular:karma",
                  "options": {
                    "polyfills": [
                      "zone.js",
                      "zone.js/testing"
                    ],
                    "tsConfig": "tsconfig.spec.json",
                    "assets": [
                      {
                        "glob": "**/*",
                        "input": "public"
                      }
                    ],
                    "styles": [
                      "src/styles.css"
                    ],
                    "scripts": [],
                    "karmaConfig": "karma.conf.js"
                  }
                }
              }
            }
          }
        }
        
        

      • Copy files "Vintasoft.Imaging.css" and "Vintasoft.Imaging.DocumentViewer.css" with CSS-styles of Vintasoft web document viewer from "<SdkInstallPath>\VintaSoft\Imaging .NET v12.4\Bin\JavaScript\" folder to the "src\" folder.
        Add information about "Vintasoft.Imaging.DocumentViewer.css" file to the "styles" section of "app\angular.json" file.
    12. Client side: Create Angular-component that allows to display document, search and extract text from document, annotate document.

      • Create "document-viewer-demo.html" file that will contain HTML markup of Angular-component:
        • Select "Add => New Item..." context menu for folder "src\app\" => "Add new item" dialog will appear
        • Select "HTML Page" type for new item
        • Set "document-viewer-demo.html" as element name
        • Click the "Add" button => dialog will be closed and file "document-viewer-demo.html" will be added into folder "src\app\"

        Add HTML markup (demo header and div element for document viewer) to the "document-viewer-demo.html" file:


        Here is HTML-code of "document-viewer-demo.html" file:
        <h1>VintaSoft Document Viewer Demo (Angular + ASP.NET Core)</h1>
        
        <div id="documentViewerContainer" style="height:800px"></div>
        
        

      • Create "document-viewer-demo.css" file that will contain CSS-styles of Angular-component:
        • Select "Add => New Item..." context menu for folder "src\app\" => "Add new item" dialog will appear
        • Select "StyleSheet" type for new item
        • Set "document-viewer-demo.css" as element name
        • Click the "Add" button => dialog will be closed and file "document-viewer-demo.css" will be added into folder "src\app\"

        Add CSS-styles to the "document-viewer-demo.css" file:


        Here is CSS-code of "document-viewer-demo.css" file:
        h1 {
          width: 1200px;
          text-align: center;
        }
        
        .documentViewerContainer {
          width: 1200px;
          height: 800px;
        }
        
        

      • Create "document-viewer-demo.ts" file that will contain code of Angular-component:
        • Select "Add => New Item..." context menu for folder "src\app\" => "Add new item" dialog will appear
        • Select "TypeScript File" type for new item
        • Set "document-viewer-demo.ts" as element name
        • Click the "Add" button => dialog will be closed and file "document-viewer-demo.ts" will be added into folder "src\app\"

        Add TypeScript code to the "document-viewer-demo.ts" file:


        Important: Visual Studio uses randomized network port for ASP.NET Core API and you need to update JavaScript code and change web services URL from "https://localhost:7259/" to URL in your application.

        Here is TypeScript code of "document-viewer-demo.ts" file:
        import { Component, OnInit } from '@angular/core';
        
        @Component({
          selector: 'app-root',
          templateUrl: './document-viewer-demo.html',
          styleUrl: './document-viewer-demo.css'
        })
        export class DocumentViewerDemo implements OnInit {
          constructor() { }
        
          ngOnInit() {
            // set the session identifier
            Vintasoft.Shared.WebImagingEnviromentJS.set_SessionId("SessionID");
        
            // specify web services, which should be used by Vintasoft Web Document Viewer
            Vintasoft.Shared.WebServiceJS.defaultFileService =
              new Vintasoft.Shared.WebServiceControllerJS("https://localhost:7259/vintasoft/api/MyVintasoftFileApi");
            Vintasoft.Shared.WebServiceJS.defaultImageCollectionService =
              new Vintasoft.Shared.WebServiceControllerJS("https://localhost:7259/vintasoft/api/MyVintasoftImageCollectionApi");
            Vintasoft.Shared.WebServiceJS.defaultImageService =
              new Vintasoft.Shared.WebServiceControllerJS("https://localhost:7259/vintasoft/api/MyVintasoftImageApi");
            Vintasoft.Shared.WebServiceJS.defaultAnnotationService =
              new Vintasoft.Shared.WebServiceControllerJS("https://localhost:7259/vintasoft/api/MyVintasoftAnnotationCollectionApi");
        
            // create settings for document viewer with annotation support
            let docViewerSettings: Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS =
              new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer", "documentViewer", true);
        
            // get items of document viewer
            let items: Vintasoft.Imaging.UI.UIElements.WebUiElementCollectionJS = docViewerSettings.get_Items();
        
            // get the main menu of document viewer
            let mainMenu: Vintasoft.Imaging.UI.Panels.WebUiPanelContainerJS =
              items.getItemByRegisteredId("mainMenu") as Vintasoft.Imaging.UI.Panels.WebUiPanelContainerJS;
            // if main menu is found
            if (mainMenu != null) {
              // get items of main menu
              let mainMenuItems: Vintasoft.Imaging.UI.UIElements.WebUiElementCollectionJS = mainMenu.get_Items();
        
              // add "Annotation" menu panel to the main menu
              mainMenuItems.addItem("annotationsMenuPanel");
            }
        
            // get side panel of document viewer
            let sidePanel: Vintasoft.Imaging.UI.Panels.WebUiSidePanelJS =
              items.getItemByRegisteredId("sidePanel") as Vintasoft.Imaging.UI.Panels.WebUiSidePanelJS;
            // if side panel is found
            if (sidePanel != null) {
              // get items of side panel
              let sidePanelItems: Vintasoft.Imaging.UI.UIElements.WebUiElementCollectionJS =
                sidePanel.get_PanelsCollection();
        
              // add "Annotations" panel to the side panel
              sidePanelItems.addItem("annotationsPanel");
        
              // add "Text selection" panel to the side panel
              sidePanelItems.addItem("textSelectionPanel");
        
              // add "Text searh" panel to the side panel
              sidePanelItems.addItem("textSearchPanel");
            }
        
            // create the document viewer
            let docViewer = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings);
        
            // create visual tool that allows to work with annotations, navigate document and select text
            let annotationNavigationTextSelectionTool: Vintasoft.Imaging.UI.VisualTools.WebVisualToolJS =
              docViewer.getVisualToolById("AnnotationVisualTool,DocumentNavigationTool,TextSelectionTool");
            // specify visual tool as mandatory visual tool of document viewer
            docViewer.set_MandatoryVisualTool(annotationNavigationTextSelectionTool);
            // specify visual tool as current visual tool of document viewer
            docViewer.set_CurrentVisualTool(annotationNavigationTextSelectionTool);
        
            // get thumbnail viewer of document viewer
            let thumbnailViewer = docViewer.get_ThumbnailViewer();
            // specify that thumbnail viewer should not cache thumbnails on server side
            thumbnailViewer.set_UseCache(false);
        
            // get image viewer of document viewer
            let imageViewer: Vintasoft.Imaging.UI.WebImageViewerJS = docViewer.get_ImageViewer();
            // specify that image viewer should not cache image tiles on server side
            imageViewer.set_UseCache(false);
            // open file from session folder and add images from file to the image viewer
            imageViewer.get_Images().openFile("VintasoftImagingDemo.pdf");
          }
        
          title = 'VintaSoft Angular Document Viewer Demo';
        }
        
        

      • Add created Angular-component to the Angular-application module - "src\app\app.module.ts" file:


        Here are source codes of "app.module.ts" file after update:
        import { BrowserModule } from '@angular/platform-browser';
        import { NgModule } from '@angular/core';
        import { FormsModule } from '@angular/forms';
        import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
        import { RouterModule } from '@angular/router';
        
        import { AppComponent } from './app.component';
        import { DocumentViewerDemo } from './document-viewer-demo/document-viewer-demo';
        
        @NgModule({
          declarations: [
            AppComponent,
            DocumentViewerDemo
          ],
          imports: [
            BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
            HttpClientModule,
            FormsModule,
            RouterModule.forRoot([
              { path: '', component: DocumentViewerDemo, pathMatch: 'full' },
            ])
          ],
          providers: [],
          bootstrap: [AppComponent]
        })
        export class AppModule { }
        
        

    13. Run Angular and ASP.NET Core application and see the result.