DocuVieware Reference Guide
Your first DocuVieware ASP.NET Web Forms page
Tutorials > ASP.NET Web Forms > Your first DocuVieware ASP.NET Web Forms page

This tutorial will show you how to integrate DocuVieware™ in a newly created C# ASP.NET Web Forms project.

Each time there is a difference between C# and VB.NET, both syntaxes will be provided.

DocuVieware™ requires .NET Framework 4.5 or above.
The screenshots have been taken using Visual Studio 2015 and GdPicture.NET™ 14, it may differ from the current release.


 Empty project creation

Start with the File > New > Project... menu, then choose Web > ASP.NET Web Application. In this tutorial you will be working on DocuViewareDemo which is new ASP.NET 4.5 Web Forms project.

Depending on your Visual Studio version, you may not already have a Global.asax file in your project. In that case you want to add it too. This is also done through the Add > New item... menu, then select Global Application Class in the list.

Here is the structure obtained:

Now that the project structure is complete, the next step will be to add project references.

 Adding mandatory referencies

The references you need to add are:

You may not have the mandatory System.Web.Http namespace directly available on your system, this is because it requires Microsoft ASP.NET Web API to be installed first.

To do this, simply run the following command in the Package Manager Console (from the Tools menu, select NuGet Package Manager and then click Package Manager Console):

PM> Install-Package Microsoft.AspNet.WebApi


You might also need to add Newtonsoft JSON, even though it should be already in the references but the version is outdated and it will most probably cause an error at runtime.

To do this, still in the Package Manager Console (from the Tools menu, select NuGet Package Manager and then click Package Manager Console), run the following command:

PM> Install-Package Newtonsoft.JSON

The project references should look like this:

At this point, please make sure that the GdPicture.NET.14.Web.DocuVieware reference is marked as Copy Local : True in its properties window:

You also need to take care of extra libraries that are mandatory for deployment, those files are found in [INSTALLATION FOLDER]\Redist\

They need to be added to the project (using the Add > Existing item... menu) and once done, the "Build Action" property should be set to "Content" and the "Copy to Output Directory" property should set to "Copy always" for each file.

 Setting up licensing

You need to go into Global.asax.cs, add the mandatory import and handle the DocuVieware™ configuration and licensing part as well.

using GdPicture14.WEB;
Imports GdPicture14.WEB

To properly unlock DocuVieware™ you are going to add a call to the RegisterKEY method in the Application_Start event.

DocuViewareLicensing.RegisterKEY("XXXX"); //Unlocking DocuVieware
DocuViewareLicensing.RegisterKEY("XXXX") 'Unlocking DocuVieware

You need to replace "XXXX" by your actual license key.

Here is what the two files should look like at this point.

 DocuVieware integration

Step 1: Add the assembly registration to the page so you can add a DocuVieware™ control on it. Here is the ASP.NET code you need to add to do this:

<%@ Register Assembly="GdPicture.NET.14.WEB.DocuVieware" Namespace="GdPicture14.WEB" TagPrefix="cc1" %>

Step 2: Add and set the DocuVieware1 object properties in the Default.aspx page, after some clean-up, like this:

<cc1:DocuVieware ID="DocuVieware1" runat="server" Height="800px" Width="1000px" />

DocuVieware™ will now have a fixed size of 1000x800 pixels.

Here is how the page source code looks like in the end:

That’s it! You can start the project and load documents in your brand new DocuVieware™.