EdgePDF
Features
Tech Specs
How-to C#
Pricing
On ASP.NET MVC
  |  
Home ›› XDoc.PDF ›› C# PDF: HTML5 PDF Viewer& Editor On ASP.NET MVC

ASP.NET MVC web PDF editor control: view, edit, redact Adobe PDF documents online using C#


How to Integrate C# .NET HTML5 PDF Viewer or HTML5 PDF Editor to ASP.NET MVC







Best HTML5 PDF Viewer Control for viewing PDF document on ASP.NET MVC project


A powerful HTML5 PDF Editor allows C# users to edit adobe PDF page and file with various functionalities in ASP.NET MVC program


Free demo package and components are provided for quick integration in ASP.NET MVC to manipulate PDF document


Support ASP.NET MVC, IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke) and SharePoint


Easy to be installed and deployed on ASP.NET MVC with online tutorial


HTML5 PDF document Viewer and Editor library are compatible with ASP.NET web based project


HTML5 PDF Viewer and Editor are based on .NET framework 2.0 and support any .NET Framework version from 2.0 to 4.6


Compatible with all Windows operating system in both 32-bit and 64-bit




Preparation for ASP.NET HTML5 PDF Viewer & Editor Deployment on ASP.NET MVC



There are two ways for using HTML5 PDF Viewer and HTML5 PDF Editor on ASP.NET MVCs application. One is to run RasterEdge_MVC3 Project directly, another is to integrate HTML5 PDF Viewer or Editor to a new ASP.NET MVC application. Following steps will guide you how to create a new ASP.NET MVC3 application and add RasterEdge HTML5 Viewer or Editor to it.


Please note: In order to reduce the size of SDK package, all dlls are put into RasterEdge.DocImagSDK/Bin directory.




Integrate ASP.NET HTML5 Viewer & Editor to ASP.NET MVC3 Application



If you want to try MVC demo directly, please download from "PDF HTML5 Editor MVC Demo" or "PDF HTML5 Editor MVC5 Razor Demo".


Also, you can create pdf html5 editor MVC demo as following steps:


Open Microsoft VisualStudio, select "New Project".


Click Visual C#, select "ASP,NET MVC 3 Web Application" and enter a Name such as "MyMVCApplication", and click OK.  (as shown in picture)





After ASP.NET MVC3 application created, there are two View engine choices: ASPX and Razor, please choose ASPX here.


Successfully created interface is as follows:





Open Global asax.cs, you can find the functions shown below.




Creating a Home folder under Views according to config in picture above. Right-click Home and select "Add New Item", pop-up box as follows, select MVC 3 View Page (ASPX) and rename it. Page name should be consistent with that in path info in figure above.





Add Controller to Index page and name it. Controller name should also be same with that in path info.




Integrate RasterEdge HTML5 PDF Viewer & Editor to ASP.NET MVC Application



Right-click your project, select "Add Reference...", add related dlls listed below:


  RasterEdge.Imaging.Annotation.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.DICOM.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.JBIG2.dll


  RasterEdge.Imaging.JPEG2000.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.Imaging.SVG.dll


  RasterEdge.XDoc.Excel.dll


  RasterEdge.XDoc.PDF.HTML5Viewer.dll ( for HTML5 PDF Viewer deployment)


  RasterEdge.XDoc.PDF.HTML5Editor.dll ( for HTML5 PDF Viewer deployment)


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.XDoc.PDF.dll


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XDoc.TIFF.dll


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Right click MyMVCApplication and select "properties". Set platform target in Build (as shown below). If you use x86 dlls, please choose x86 platform here, or select x64 if you use x64 dlls.





When you select x64 and directly run the application, you may get following error. Please try to deploy HTML5 Viewer in IIS.





Open RasterEdge_MVC3 DemoProject, copy following content to your project:


  Index.aspx


  HomeController.cs


  Global.asax.cs


  RasterEdge_Resource_Files Folder


  RasterEdge_Demo_Docs Folder


  RasterEdge_Cache Folder


  Global.asax.cs


Note: Namespaces in HomeController.cs and Global.asax.cs should be same with the default namespace in application.


Add log.txt to project, it's mainly for recording exceptions occurred when application running.


Web.Config Setting.


  Add following <appSettings> node to your application. (The application cannot to work without this node.)




    <appSettings>
        <add key="cacheFolder" value="RasterEdge_Cache"/>
        <add key="resourceFolder" value="RasterEdge_Resource_Files"/>
    </appSettings>




  Add node <system.web.extensions>, maxJsonLength can be changed as needed.




    <system.web.extensions>
        <scripting>
            <webServices>
                <jsonSerialization maxJsonLength="50000000">
                </jsonSerialization>
            </webServices>
        </scripting>
    </system.web.extensions>




  Add <system.webServer> node.


You’d better to: 1. Set allowDoubleEscaping as “ture”, otherwise some requests cannot response successfully. 2. Add fill extension such as .woff, it’s mainly to insure .woff font can response and display correctly.




    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <security>
            <requestFiltering allowDoubleEscaping="true">
                <requestLimits maxAllowedContentLength="41943040"/>
            </requestFiltering>
        </security>
        <staticContent>
            <remove fileExtension=".js"/>
            <remove fileExtension=".svg"/>
            <remove fileExtension=".woff"/>
            <mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>
            <mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
            <mimeMap fileExtension=".ttc" mimeType="application/x-font-ttc"/>
            <mimeMap fileExtension=".js" mimeType="application/x-javascript"/>
        </staticContent>
        <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
    </system.webServer>




Press F5, interface run as follows.