ASP.NET Core PDF Viewer & Editor
How to open, read, display a PDF file in ASP.NET MVC using C#

Load a pdf file from server side file system, database, online file, and view it in ASP.NET PDF Viewer in ASP.NET Core, MVC web application in Azure.

Open, read and view an existing PDF file in ASP.NET using C# is very simple. EdgePDF provides several methods to accomplish the task.

How to read, view, edit PDF file in

  1. Download EdgePDF PDF viewer web control
  2. Install library demo project in IIS
  3. Step by step tutorial


To run the following tutorial successfully, we need the following setup ready.

  1. For ASP.NET Core web app: Setup EdgePDF
  2. For ASP.NET Core MVC web app: Setup EdgePDF
  3. For ASP.NET (.net framework): Setup EdgePDF on IIS
  4. A demo Adobe PDF document in folder C:\temp\pdf-1.pdf

How to load PDF document into EdgePDF ASP.NET PDF Editor

To run the following demo code, please do the following steps:

  1. Create and add the follow sample documents to folder "c:\temp\"
    • pdf-1.pdf
    • tiff-1.tif
    • word-1.docx
    • excel-1.xlsx
    • powerpoint-1.pptx
    • jpeg-1.jpg
    • text-1.txt
  2. Make sure IIS application (User: IIS_IUSRS) has the read and write rights to the folder "temp“, and all files inside.

    The following guide will help to setup a demo project, which allows you to open a file (pdf, word, excel, powerpoint, tiff, jpeg, text) located under your server file system "C:/temp/", through url:

    Next one will allow you to define a new command in EdgePDF toolbar. And you can save modified pdf file to original file location "C:/temp/1.pdf"

    Here are the details:

    • For ASP.NET Core web app, open file UserCommandProcessMiddleware.cs from /DemoProjects/EdgePDF for ASP.NET Core/, go to method "FileProcess()"

    • For ASP.NET (.net framework) project, In /RasterEdge_Resource_Files/UserCommandProcessHandler.ashx method "FileProcess()"

                else if (!string.IsNullOrEmpty(request.QueryString["yourtarget"]))
                    // load file from your target
                    String docid = request.QueryString["yourtarget"];                
                    if (docid == null) docid = "0";
                    byte[] dataBytes = System.IO.File.ReadAllBytes(@"C:\\temp\" + docid);
                    String fileName = docid;               
                    webDoc = REProcessControl.PageLoadFile(request, this.Manager, dataBytes, fileName);

    You can use the "yourtarget" value to id and locate your file from file system or database, and load the file into PDFDocument or BaseDocument object.

    • Now you navigate to "http://localhost/?yourtarget={your file location key, such as '/pdf-1.pdf'}" to open file in EdgePDF editor.
    • You can change http parameter yourterget to other names, like fileid.
  3. You can easily publish, deploy the ASP.NET web app to Azure. View details at How to deploy ASP.NET Core PDF viewer web application to Azure?

Open a PDF from your local file system

Toolbar: File > File Upload > "Upload your PDF file"
Click browser, and select a PDF document from your file system.

Open a PDF from a http url

Toolbar: File > File Upload > "Open an online PDF file"
Input a complete PDF online document url

Next Steps

Download and try EdgePDF - ASP.NET PDF Editor Control with online support.
See the EdgePDF - ASP.NET PDF Editor Control SDK in action and check how much they can do for you.

Check out the prices. Purchase various licenses for your needs.