Using ASP.NET Azure PDF Viewer Web Control API
ASP.NET Azure PDF Editor Control: how to read, view, create, generate, edit, annotate PDF files in asp.net, mvc, azure


How to enable pdf create, generate, convert, read, view, word/excel/tiff/image convert, redact text, text extract, text search, ocr functions in ASP.NET Azure web application.











  • Best .NET HTML5 PDF Viewer Control to create, generate, read, view, convert, extract text, text search, ocr pdf files on Microsoft Azure project in C# programming language
  • Easy to convert Microsoft Word, Excel, and tiff image documents to Adobe pdf files using C# api in Azure web app
  • A professional .NET HTML5 PDF Editor empower C# users edit adobe PDF file in multiple functionalities on AzureCloudService program
  • Free demo package and components are provided for quick integration in Azure to manipulate PDF document in C#.NET
  • Support ASP.NET MVC, IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke) and SharePoint
  • Easy to be installed and deployed on Azure with online tutorial
  • ASP.NET Azure PDF reader and Editor library are compatible with ASP.NET web based project
  • HTML5 PDF Viewer and Editor 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









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



There are two ways for using HTML5 PDF Viewer and HTML5 PDF Editor on AzureCloudService project. One is to run RasterEdge_AzureCloudService Project directly, another is to integrate HTML5 PDF Viewer and Editor to a new AzureCloudSevice application. Following steps will guide you how to create a AzureCloudSevice project and add RasterEdge HTML5 Viewer or HTML PDF Editor to it.

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







Create an EdgePDF integrated AzureCloudService project



1. Create a new Azure Cloud Service project "EdgePDFAzureCloudService".









2. Add RasterEdge assemblies (all DLLs with name prefix 'RasterEdge' ).





All DLLs locates in the download package "/Bin", choose .NET 4.0, x64 dlls. Add all DLLs with prefix "RasterEdge" to the project reference.

3. Change the target platform to "x64"





4. Add a New Web Form Item "Default.aspx" to the project WebRole1.





Replace all contents in the file Default.aspx by the following codes.

File: Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebRole1.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" moznomarginboxes mozdisallowselectionprint>
<head runat="server">
    <title>PDF Online Editor</title>
        <script src="/RasterEdge_Resource_Files/javascript/jquery.js" type="text/javascript"></script>
    <script src="/RasterEdge_Resource_Files/javascript/RasterEdge_WebApp_Customize.js" type="text/javascript"></script>
    <script src="/RasterEdge_Resource_Files/javascript/RasterEdge_WebApp.js" type="text/javascript"></script>
    <script src="/RasterEdge_Resource_Files/javascript/RasterEdge.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/RasterEdge_Resource_Files/css/process.css" type="text/css" />
    <link rel="stylesheet" href="/RasterEdge_Resource_Files/css/customize.css" type="text/css" />
    <link rel="stylesheet" href="/RasterEdge_Resource_Files/css/jquery-ui.css" type="text/css" />
    <script type="text/javascript">
        var _rootpath = "/";
        _WDPApp = new WDPOnlineApplication({
            _serverUrl: "/RasterEdge_Resource_Files/UserCommandProcessHandler.ashx"
        });
    </script>
</head>
<body>
    <div id='rasteredge_wdp'>
        <div id='wdp_Toolbar'></div>
        <div id='wdp_LeftSidebar'></div>
        <div id='wdp_Viewer'></div>
        <div id='wdp_RightSidebar'></div>
        <div id='wdp_Footer'></div>
    </div>
</body>
</html>






Replace all contents in the file Default.aspx.cs by the following codes.

File: Default.aspx.cs
using System;
using System.Web.Configuration;
using RasterEdge.WDP;
using RasterEdge.XDoc.PDF.HTML5Editor;

namespace WebRole1
{
    public partial class Default : System.Web.UI.Page
    {
        public String MsgToClient = "";
        public String cacheFolder = WebConfigurationManager.AppSettings.Get("reCacheFolder");

        protected void Page_Load(object sender, EventArgs e)
        {
            String command = Request.Form["RECommand"];
            if (command == null || command.Equals(""))
            {
                if (Request.Files.Count > 0)
                {
                    if (Request.Form["add"] != null)
                        UploadFileToAdd();
                    else
                        LoadFileFromUpload();
                }
                else if (Request.Form["src"] != null)
                    LoadFileFromOnline();
            }
        }

        public void LoadFileFromUpload()
        {
            PDFWebDocument webDoc = REProcessControl.CreateWebDocFromUpload(Request, null);
            REProcessControl.ResponseToClient(webDoc.MsgToClient, Response);
        }

        public void LoadFileFromOnline()
        {
            String src = Request.Form["src"];
            PDFWebDocument webDoc = REProcessControl.CreateWebDocFromOnLine(src, "", null);
            REProcessControl.ResponseToClient(webDoc.MsgToClient, Response);
        }

        public void UploadFileToAdd()
        {
            String msgToClient = REProcessControl.UploadInsertFile(Request);
            REProcessControl.ResponseToClient(msgToClient, Response);
        }
    }
}






5. Copy the folder "/DemoProjects/EdgePDF Demo Project/RasterEdge_Resource_Files" and all its contents to the sample project WebRole1.







6. Add new entries to the Web.config file.





Insert 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"/>    


Insert the following contetns to tag <system.webServer>:

    <security>
      <requestFiltering allowDoubleEscaping="true">
        <requestLimits maxAllowedContentLength="41943040"/>
      </requestFiltering>
    </security>
    <staticContent>
      <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"/>
    </staticContent>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>


Add (or merge) 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 , you need merge the above content to the existed tag contents.



7. It is done. Now press F5 to run the project.