Getting Started with ASP.NET MVC Standalone PDF Viewer Control

2 May 20244 minutes to read

The ASP.NET MVC PDF Viewer control is used to viewing and printing PDF files in any web application. It provides the best viewing experience available with core interactions such as zooming, scrolling, text searching, text selection, and text copying. Thumbnail, bookmark, hyperlink and table of contents support provides easy navigation within and outside the PDF files.

This section briefly explains about how to integrate ASP.NET MVC PDF Viewer control in your ASP.NET MVC application using Visual Studio.


System requirements for ASP.NET MVC controls

Integrate PDF Viewer into an ASP.NET MVC application

  1. Start Visual Studio and select Create a new project.
  2. Create a new ASP.NET MVC Web Application project.
  3. Choose the target framework.
  4. Select Web Application pattern (MVC) for the project and then select Create button.

ASP.NET MVC PDF Viewer NuGet packages installation

To add .NET PDF Viewer control, the following NuGet packages need to be installed in your ASP.NET MVC application.


If you creating ASP.NET MVC application with MVC4 package, search for Syncfusion.EJ2.MVC4 and then install it.

Add namespace

Add Syncfusion.EJ2 namespace reference in Web.config under Views folder.

    <add namespace="Syncfusion.EJ2"/>

Add style sheet

The theme is referred using CDN inside the <head> of ~/Views/Shared/_Layout.cshtml file as follows,

    <!-- Syncfusion ASP.NET MVC controls styles -->
    <link rel="stylesheet" href="" />


Checkout the Themes topic to learn different ways (CDN, NPM package, and CRG) to refer styles in ASP.NET MVC application, and to have the expected appearance for Syncfusion ASP.NET MVC controls.

Add script reference

Add the required scripts using CDN inside the <head> of ~/Views/Shared/_Layout.cshtml file as follows,

    <!-- Syncfusion ASP.NET MVC controls scripts -->
    <script src=""></script>


While referring the scripts from the downloaded resources in your application, make sure to place the ‘ej2-pdfviewer-lib’ assets in the same directory as the ‘ej2.min.js’ script.

Register Syncfusion Script Manager

Open ~/Views/Shared/_Layout.cshtml page and register the script manager in the ASP.NET MVC application as follows.

    <!-- Syncfusion ASP.NET MVC Script Manager -->


Add the script manager EJS().ScriptManager() at the end of <body>.

Add ASP.NET MVC PDF Viewer control

Add the Syncfusion ASP.NET MVC PDF Viewer control in ~/Views/Home/Index.cshtml page. You can load a PDF file in the PDF Viewer by specifying the document name in the DocumentPath property as below.

    ViewBag.Title = "Home Page";

    <div style="height:500px;width:100%;">

DocumentPath is the property needed to load a PDF file in the PDF Viewer.

Press Ctrl+F5 (Windows) or +F5 (macOS) to run the app. Then, the Syncfusion ASP.NET MVC PDF Viewer control will be rendered in the default web browser.

ASP.NET MVC PDF Viewer Control


View Sample in GitHub.


You can refer to our ASP.NET MVC PDF Viewer feature tour page for its groundbreaking feature representations. You can also explore our ASP.NET MVC PDF Viewer example to understand the core features of PDF Viewer.

Limitation over Server-Backed PDF Viewer to Standalone PDF Viewer control

When comparing a Standalone PDF Viewer to a Server-Backed PDF Viewer control, it’s crucial to understand the limitations that the Standalone PDF Viewer may have in comparison. These limitations are important to consider

Local File Access

  • The Standalone PDF Viewer control does not have the capability to directly access and load local physical files from a user’s device. As a result, it is not possible to use a documentPath to load a PDF file directly from a local server within the viewer.

  • The Standalone PDF Viewer allows users to export annotations and form fields from the viewer, it’s important to be aware that the viewer does not support the direct import of annotations and form fields from a locally specified file path. In other words, you can extract annotations and form fields from the viewer, but you cannot reintroduce them into the viewer from external sources by specifying a file path located on your local device.


These limitations are temporary and are expected to be addressed in the near future.