Using ASP.NET MVC PDF Viewer
How to open, view, display, annotate, redact, create, export PDF file in MVC 4 & 5. Free Download.

In ASP.NET MVC, how to open, load, create, generate, view, display, convert, export, download PDF file using C# web api. Free trial package download.

In this tutorial, you learn how to integrate an ASP.NET PDF viewer in your ASP.NET MVC web application. With the tutorial, you will enable your ASP.NET MVC web app with the following online PDF functions.

  • View, navigate PDF content
  • Annotate, markup, draw on PDF page
  • PDF text, image content editing
  • Redact PDF text, image content, or pages
  • Process PDF document, pages online
  • Convert Word, Excel, PowerPoint, Tiff, images to PDF online
  • Export PDF document to Word, Tiff, html, image files

How to open, view PDF file in your ASP.NET MVC web app

  1. Download EdgePDF ASP.NET MVC PDF viewer web control
  2. Prerequisites
  3. Step by Step Guide

  • Best ASP.NET PDF Viewer Control for viewing PDF files on ASP.NET MVC 4 & MVC 5 project
  • A powerful HTML5 PDF Editor allows C# users to edit adobe PDF page and file with various functionalities in ASP.NET MVC program
  • Detailed demo code example and how to guide to help open, create, generate, view, annotate, export pdf files in ASP.NET MVC project
  • Free demo package and components are provided for quick integration in ASP.NET MVC to manipulate PDF document
  • Easy to load pdf file from byte array, stream object, file system,database, and display it in EdgePDF PDF html viewer.
  • Support ASP.NET MVC 4 & MVC 5, IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke) and SharePoint
  • Easy to be installed, customized and deployed on ASP.NET MVC with online tutorial
  • Quick to customize and extend existing pdf edit, convert, print using C# api and Javascript (js) api.
  • Fast to load, display a PDF file in web browser with partial document loading algorithms.
  • HTML5 PDF Viewer and Editor library are based on .NET framework 3.5 and support any .NET Framework version from 3.5 to 4.8
  • Compatible with all Windows operating system in both 32-bit and 64-bit


This tutorial teaches you the basics of building an ASP.NET MVC 5 web app with PDF viewing, editing enabled using Visual Studio 2017.

You need the following requirements to run the web app:

  1. RasterEdge SDK Free Trial Package
  2. Visual Studio 2017
  3. .net framework 3.5, 4.0 or later version

Integrate EdgePDF to ASP.NET MVC5 web app

You can create EdgePDF pdf editor MVC demo as following steps:

  • Open Microsoft Visual Studio 2017, create a new ASP.NET MVC 5 Project "EdgePDFMVC5Demo"

  • Add RasterEdge dll reference (add all dll names starting with RasterEdge)

    Please go to download package "/Bin", choose .net 4.0, x86 dlls. Add all dlls with starting name "RasterEdge." to your project reference.

    Note: Visual Studio embed web server (IIS Express) is for x86 only. Please choose x86 dlls from Bin folder.

  • In this demo, we will use the default controller "HomeController", and default view "Index.cshtml"

  • Copy the contents in file "/Developer Guide/EdgePDF/MVC5 project files/Index.cshtml" to your new created Index.cshtml file.

  • Add the folder "/DemoProjects/EdgePDF Demo Project/RasterEdge_Resource_Files" (all contents) to project.

  • Set the project Web.config

    Add the following contents to tag <appSettings>:
        <!-- the cache folder -->
        <add key="reCacheFolder" value="RasterEdge_Cache"/>
    	<add key="reCustomStampFolder" value="RasterEdge_Resource_Files/images/stamp"/>
        <!-- set the server folder if you want to open the file on server-->
        <add key="reDefaultFolder" value="RasterEdge_Demo_Docs"/>
        <!-- set the default file when open the web first time,if set "" ,this function is disabled. (reDefaultFolder needed) -->
        <add key="reDefaultFilePath" value=""/>
        <!-- image quality in PDF document -->
        <add key="rePageImageZoom" value="2"/>
        <add key="reImageZoom" value="2"/>
        <!-- image annotation in PDF document -->
        <add key="reAnnotationImageZoom" value="2"/>
        <!-- write log -->
        <add key="reOutputLogData" value="true"/>
        <!-- if true, SDK will automatically convert many shape and path inside PDF page into image-->
        <!-- default is false -->
        <!--  DEBUG ,INFO ,WARNING,ERROR -->
        <add key="reLogLevel" value="DEBUG"/>
        <add key="reWDPFileCacheMaxLimit" value="0"/>
       <add key="reIntelliDrawShapesToImage" value="true"/>
        <!-- if reIntelliDrawShapesToImage is true, -->
        <!-- valid values are: 	"all", "firefox", "chrome", "ie", "edge", "salari", "others"	if "all" included, ignore the rest;	default is "all"    -->
        <add key="reIntelliDrawShapesToImageSupportBrowsers" value="all"/>
        <!-- set the type of the show page.
    	Valid values: svg, png,html
            Default: svg
        <add key="reDocRenderEngine" value="svg"/>
        <add key="reRestfulFolder" value="c:/RasterEdge_Restful"/>
        <add key="reI18NFolder" value="/RasterEdge_Resource_Files/i18n/"/>
    <add key="reServerURL" value=""/><!-- set the domain for remote client-->
        <!-- If true, SDK will automatically call ... after file has been uploaded. Deafult: false. -->
        <add key="autoProcessWholeDocument" value="false"/>
        <!-- If true, SDK will automatically call ... after file has been uploaded. Default: false. -->
        <add key="autoIndexTextSearchWholeDocument" value="false"/>

    Add the following contents to tag <system.webServer>
          <requestFiltering allowDoubleEscaping="true">
            <requestLimits maxAllowedContentLength="41943040"/>
    	<remove fileExtension=".js"/>
           <remove fileExtension=".svg"/>
          <remove fileExtension=".woff"/>
          <remove fileExtension=".ttc"/>
          <remove fileExtension=".xfdf"/>
          <remove fileExtension=".fdf"/>
          <mimeMap fileExtension=".xfdf" mimeType="application/octet-stream"/>
          <mimeMap fileExtension=".fdf" mimeType="application/octet-stream"/>
          <mimeMap fileExtension=".woff" mimeType="application/octet-stream"/>
          <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
          <mimeMap fileExtension=".ttc" mimeType="application/x-font-ttc"/>
          <mimeMap fileExtension=".js" mimeType="application/x-javascript"/>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>

    Add the following contents to tag <system.web>
    <httpRuntime requestValidationMode="2.0" executionTimeout="1200" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/>

    Note: If web.config has already defined tag "<httpRuntime>", you need merge the above content with existed tag contents.

  • Set the cache folder auto-clear rules. Copy or add the "/Developer Guide/EdgePDF/MVC5 project files/Global.asax.cs" file to your MVC project.

  • Change MVC project target platform to "x86"

Run the web app to view PDF document online in web browser

Select Ctrl+F5 to run the app without the debugger.

Visual Studio 2017 runs the ASP.NET MVC 5 web app and opens the default browser.

Now you can upload a PDF document, and view, navigate the PDF content in the web browser.