How to Use GroupDocs’ Document Viewer for .NET MVC4
We are often asked whether our GroupDocs Viewer for .NET works with Microsoft ASP.NET MVC 4. The answer is YES, it works well. In this article, we will learn how to use the ASP.NET HTML5 DLL version of GroupDocs’ document viewer with .NET MVC 4.
Microsoft ASP.NET MVC 4
Сonnection and use
To use the DLL version of GroupDocs’ document viewer for .NET in an ASP.NET MVC Project:
Download GroupDocs Viewer for .NET to your local PC. You can buy or download trial version here.
Copy the GroupDocs Viewer.dll file to the project’s reference folder.
Add a reference to the Groupdocs.Viewer.dll assembly to your project.
Insert the following calls into the Application_Start method of your Global.asax.cs:
GroupdocsViewer.InitRoutes();// registers routes for the Viewer
GroupdocsViewer.SetLicensePath(<path to your license file if you have one>);
GroupdocsViewer.SetRootStoragePath(<path to the directory where you store your documents and image cache of the Viewer>);
Insert the following code to load GroupDocs Viewer for .NET scripts and CSS into the <head> section of your _Layout.vbhtmlfile:
In the Global.asaxfile, add this code just after AreaRegistration.RegisterAllAreas()
Groupdocs.Web.UI.GroupDocsViewer.SetLicensePath(<path to your license file if you have one>);
Groupdocs.Web.UI.GroupdocsViewer.SetRootStoragePath("<path to the directory where you store your documents and image cache of the Viewer>")
Insert the following code to load Groupdocs Viewer for .NET scripts and CSS into the <head>section of your page:
You can set options to insert code which will load jQuery and jQuery UI scripts: