WebForms: Application creation
You can find the ASP.NET Document Viewer demo for C# at “%USERPROFILE%\Documents\Gnostice\XtremeDocumentStudio .NET\Demos\03. ASP.NET\C#\ASP .NET WebForms\01. Document Viewer” on installed machine.
Steps to integrate ASP.NET Document Viewer in ASP.NET web application (using WebForms).
1.Open Visual Studio and create a new ASP.NET Web Application (.NET Framework). In the wizard choose "Empty" and choose "Add folders and core references for: Web Forms".
2.Add references to the following DLLs (from the XtremeDocumentStudio installation folder) and set their "Copy to Local" property to True.
●Gnostice.Documents.WebHandler.dll
●Gnostice.Core.dll
●Gnostice.Documents.dll
●Gnostice.XtremeFontEngine.4.0.dll
●Gnostice.XtremeImageEngine.dll
●Ionic.Zip.Reduced.dll
●log4net.dll
●Newtonsoft.Json.dll
3.Install the NuGet package “XtremeDocumentStudio.NETHTMLClient” to your project. You can either use the GUI or type out the command "Install-Package XtremeDocumentStudio.NETHTMLClient" in the package manager console. This package delivers a preconfigured Web.config file which contains server-side settings of the Document Viewer. To know more about all the settings, refer to the Web.config reference documentation.
4.Configure the DocumentCache setting in Web.config file. This setting specifies the location where the processed data should be cached. You can refer to the FAQ to know which cache location is right for you.
○To use RAM as the temporary storage for processed document data, no changes are required. DocumentCache is already setup as "memory".
○To use Database as the temporary storage for processed document data
oChange the value of DocumentCache setting in Web.config to “database”
oAdd the following settings under “appSettings” and provide values for them
a.DBConnectionStringName
b.DBCleanupRetentionTime
c.DBCleanupIntervalTime
For more detailed description on why we need document caching, please refer the Application Scenario section.
5.Add the license key you received as the value for the “LicenseKey” setting in Web.config file. If you are using the trial version, you can use the license key that is shown on XtremeDocumentStudio downloads page. If you are using a registered version, please use the license key in the delivery note you received after purchasing the product.
<!--Replace 'Your-License-Key' with the actual provided key-->
|
6.Add an ASP.NET "Web Form" with name "Viewer" to your project. Right-click on the newly added form and set it as the "Start Page".
7.Copy/paste the following JavaScript and CSS inclusion statements to the "<head>" section of your WebForm (Viewer.aspx). For Make sure the order of inclusion of the files matches with what is shown below.
<script src="Scripts/Gnostice/jquery-1.11.0.min.js"></script>
|
8.Add a <div> tag like this to the form and give it the same ID ("doc-viewer-id") as used in the ViewerInitializer.js script.
<div id="doc-viewer-id" style="width: 100%; height: 700px;"></div>
|
9.Build the project and run the Web application in your favorite browser.
10.Click on open button control from viewer’s toolbar to load the document from your machine.