Angular 9 Render PDF Documents Using ng2-pdf-viewer Node Module


Hi friends today in this video i will be talking about how to render pdf documents using ng2-pdf-viewer Node Module. In this video i have illustrated a step by step approach on how to do this.

Angular 9 Render PDF Documents Using ng2-pdf-viewer Library 2021



npm install ng2-pdf-viewer --save




Add PdfViewerModule to your module’s imports


import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { PdfViewerModule } from 'ng2-pdf-viewer';
  imports: [BrowserModule, PdfViewerModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
class AppModule {}


After including the library we can use it inside our app component like this


import { Component } from '@angular/core';
  selector: 'example-app',
  template: `
  <pdf-viewer [src]="pdfSrc" 
              style="display: block;"
export class AppComponent {
  pdfSrc = "";


And now if you open the angular app you will see our pdf file rendered on the screen.

Leave a Reply