Learn MVC Using Angular PDF File Viewer6 min read


This article demonstrates how to use Angular PDF File Viewer in Visual Studio 2017.

Angular PDF File Viewer

Angular Portable Document Format (PDF) File Viewer is built with HTML 5 and supported by Mozilla Labs. It is a web standard based platform for parsing and rendering PDFs.


The delegate service injects this Controller, so you can fetch an instance using its delegate handle and call methods.

The following methods are available to the delegate.

  • Prev
  • Next
  • Zoom In
  • Zoom Out
  • Zoom To
  • Rotate
  • Page Count
  • Go to Page
  • Load

Following the below steps, you can use Angular File Upload in AngularJS in MVC.

  • Create an MVC Project.
  • Configure an Angular PDF File Viewer.
  • Work in Angular PDF File Viewer.

Create MVC Project

Open Visual Studio 2017.


Go to New >> New project. Now it will open the “New Project” window.


You can select ASP.NET Web Application on Framework 4.5. Enter the name of the project in the “Solution name” text box and click OK.


One more window should appear. Select MVC Template in this pop-up and click OK. Now, start cropping the image.

Configure Angular PDF File Viewer

You can download the plug-in from.

Open the _Layout.cshtml; it must refer the .js file from the downloaded folder to this view page.

Link your Angular configurable file.

Angular Module

You need to include the module as a dependency of your application.

Work in Angular PDF File Viewer

“PDF” is my Angular module’s name, so I have added the “ng-app.”

 HTML Code

The directive <pdf-viewer> can manage the URL, scale Request Header, and delegate-handler. They can also be set using the attributes. The pdfDelegate delegate service allows you to access and control individual parts of a directive. This allows us to have multiple instances of the same directive in the same Controller.

Angular Controller

Initiate the File to object. This object will be loaded from the local host or URL. Create one folder in the Solution Explorer, then keep it all in the PDF; or you can use Angular service for URLs, and get the file from the database.


Click F5 button to run the application. Now, it will appear in the browser and you can see the result.

Output 1


PDF is loaded in the same HTML page with the tool bar.

Output 2


The default toolbar can be shown or hidden using the show-toolbar attribute. If needed, you can place the toolbar on a separate $scope.

If you have any queries, please tell me through the comments section.

Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *