We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can PDF viewer be used in Angular 6 application?

Platform: JavaScript |
Control: ejPdfViewer |
Published Date: August 2, 2018 |
Last Revised Date: January 22, 2019

Essential JS 2 PDF Viewer

 

Syncfusion Angular UI (Essential JS 2) is a collection of modern TypeScript based true Angular components. The PDF Viewer component is developed from the ground up to be lightweight, responsive, modular and touch friendly.

It is compatible with Angular 6.0.0. Refer to the following UG link for prerequisites of Angular framework.

Setup Angular Environment

 

You can use the Angular CLI to setup your Angular applications.

To install Angular CLI use the following command.

npm install -g @angular/cli

 

Create an Angular Application

 

Start a new Angular application using the Angular CLI command as follows.

ng new my-app

cd my-app

 

 

Adding Syncfusion PDF Viewer package

 

All the available Essential JS 2 packages are published in npmjs.com registry.

To install PDF Viewer component, use the following command.

npm install @syncfusion/ej2-angular-pdfviewer --save

 

Note: The --save will instruct NPM to include the PDF Viewer package inside of the dependencies section of the package.json.

Registering PDF Viewer module

 

Import PDF Viewer module into Angular application(app.module.ts) from the package @syncfusion/ej2-angular-pdfviewer[src/app/app.module.ts].

TS

 

Adding CSS reference

The following CSS files are available in ../node_modules/@syncfusion package folder. This can be referenced in [src/styles.css] using the following code.

 

CSS

 

Add PDF Viewer component

Modify the template in [src/app/app.component.ts] file to render the PDF Viewer component. Add the Angular PDF Viewer by using <ejs-pdfviewer> selector in template section of the app.component.ts file.

TS

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/my-app2054068837

UG link:  https://ej2.syncfusion.com/angular/documentation/pdfviewer/getting-started.html

 

 

Essential JS 1 PDF Viewer

 

PDF Viewer is compatible with Angular 6.0.0. Refer to the following UG link for prerequisites of Angular framework.

https://help.syncfusion.com/angular/gettingstarted/overview

The following code illustrates how to integrate PDF Viewer in Angular 6 application.

HTML

 

TS

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_Angular6869299007

 

UG link:  https://help.syncfusion.com/angular/pdfviewer/getting-started

 

ADD COMMENT
You must log in to leave a comment
Comments
B Carducci
Oct 04, 2018

So what I'm not seeing is what Library in Angular 6 would I need to install via NPM in order to use the viewer.  If it's a Javascript library only, where do I get the viewer's JS libraries?

Reply
Akshaya Arivoli [Syncfusion]
Oct 08, 2018

Hi B Carducci,

 

Thank you for your update.

 

Please find the below UG link for Configuring Syncfusion npm Packages in your application.

 

https://help.syncfusion.com/js/installation-and-deployment#configuring-syncfusion-npm-packages

 

Note: The above npm package will contains the PDF viewer control.

 

Also, please find the steps to run the Angular JS application,

 

Running the App

  • Make sure you have installed the prerequisites of Angular framework.
  • Navigate to your application location
  • run npm install to install dependencies.
  • run npm start to fire up dev server.
  • open browser to http://localhost:3000
  • If you want to use other port, open package.json file, then change port in --port 3000 script and also change the port in config/webpack.dev.js.

Please try this and let us know if you have any concerns on this.

 

Regards,

Akshaya

Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon