Group Doc: HTML5 document viewer
My search starts when we need a Document Viewer in our project that will:
- Work on a Windows Server and with .NET.
- Support a new and Old Version of Pdf.
- Support Microsoft Office Documents.
- Support Tiff File.
- Image File Support and many others.
We have checked many APIs, DLLs, and SDK, but the one who caught our attention is GroupDoc Viewer for .NET.
Firstly, I will demonstrate why one choose this option.
Group Doc is:
- Clean and lightweight.
- Easy to use Dll.
- Has many options for a user like printing, open other files, zoom in / out, etc.
- Support for 50+ file types.
From points 1 and 2 we have to add groupdoc dll in our application.
Now I will illustrate how to use Group Doc code for getting our desired outcome.
Step 1: Add dll in Add Reference in Bin folder.
Step 2: Add the following to Global.asax.
- Viewer.InitRoutes();
- Viewer.SetRootStoragePath(Server.MapPath("~/testfiles/")); // Documents will also be cached here
- Viewer.SetLicensePath(Server.MapPath("SomePathToYourLisenceFile")); //in our case its free/unlicence dll :)
- //Remember testfiles is just a folder which contains your different documents like abc.pdf,xyz.tif etc. I have added these files below in step-7.
- <httpHandlers>
- <add verb="GET,POST" path="document-viewer/ViewDocumentHandler" type="Groupdocs.Web.UI.Handlers.ViewDocumentHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="*" path="document-viewer/GetDocumentPageImageHandler" type="Groupdocs.Web.UI.Handlers.GetDocumentPageImageHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="*" path="document-viewer/LoadFileBrowserTreeDataHandler" type="Groupdocs.Web.UI.Handlers.LoadFileBrowserTreeDataHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="*" path="document-viewer/GetImageUrlsHandler" type="Groupdocs.Web.UI.Handlers.GetImageUrlsHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET" path="document-viewer/CSS/GetCssHandler" type="Groupdocs.Web.UI.Handlers.CssHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET" path="document-viewer/images/*" type="Groupdocs.Web.UI.Handlers.EmbeddedImageHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET" path="document-viewer/fonts/*" type="Groupdocs.Web.UI.Handlers.GetFontHandler, Groupdocs.Viewer, Culture=neutral" />
- <add verb="GET,POST" path="document-viewer/GetScriptHandler" type="Groupdocs.Web.UI.Handlers.ScriptHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET" path="document-viewer/GetFileHandler" type="Groupdocs.Web.UI.Handlers.GetFileHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET,POST" path="document-viewer/GetPdf2JavaScriptHandler" type="Groupdocs.Web.UI.Handlers.GetPdf2JavaScriptHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET,POST" path="document-viewer/GetPdfWithPrintDialogHandler" type="Groupdocs.Web.UI.Handlers.GetPdfWithPrintDialogHandler, Groupdocs.Viewer, Culture=neutral" validate="false" />
- <add verb="GET,POST" path="document-viewer/GetPrintableHtmlHandler" type="Groupdocs.Web.UI.Handlers.GetPrintableHtmlHandler, Groupdocs.Viewer, Culture=neutral" />
- <add verb="GET,POST" path="document-viewer/GetResourceForHtmlHandler" type="Groupdocs.Web.UI.Handlers.GetResourceForHtmlHandler, Groupdocs.Viewer, Culture=neutral" />
- <add verb="GET,POST" path="document-viewer/GetDocumentPageHtmlHandler" type="Groupdocs.Web.UI.Handlers.GetDocumentPageHtmlHandler, Groupdocs.Viewer, Culture=neutral" />
- <add verb="GET,POST" path="document-viewer/ReorderPageHandler" type="Groupdocs.Web.UI.Handlers.ReorderPageHandler, Groupdocs.Viewer, Culture=neutral" />
- <add verb="GET,POST" path="document-viewer/RotatePageHandler" type="Groupdocs.Web.UI.Handlers.RotatePageHandler, Groupdocs.Viewer, Culture=neutral" />
- </httpHandlers>
- <%@ Import Namespace="System.NET" %>
- <%@ Import Namespace="Groupdocs.Web.UI" %>
- //To Load Jquery.
- <%= Viewer.CreateScriptLoadBlock().LoadJquery().LoadJqueryUi() %>


Từ Công HiếuPosted Jul 28, 2021, 3:33 AM
Thanks you for this post. Can you share theo code in [email protected]
rajesh choudharyPosted Aug 4, 2020, 9:46 AM
Great post can u share the Code in [email protected]
yogesh thakkarPosted Jan 5, 2019, 11:24 AM
Hello nice post but i am not able to run it i got the Groupdocs.Web.UI namspace error and could not solve this error. so can you please send me the code on [email protected] asap.
Richa PatelPosted Aug 23, 2018, 7:58 AM
I was implemented the same as given above code. but I was unable to reproduce the viewer on screen. and there were no errors showing in the console. Can you pls suggest me what is the issue in my code. Can you send me your demo project in my Email: [email protected]
Nguyen 0Posted May 28, 2017, 10:00 AM
Thanks for shareing. You send code for me . Email : [email protected]
Sonu ChaudharyPosted Feb 25, 2016, 6:35 AM
good one!
Santhakumar MunuswamyPosted Jan 13, 2016, 10:54 AM
Thanks for nice share
Muhammad Aqib ShehzadPosted Jan 12, 2016, 11:24 AM
nice sharing dear
Mohsin AzamPosted Jan 12, 2016, 7:16 AM
Thanks All...
Kumaresh RajalingamPosted Jan 12, 2016, 12:38 AM
Good one
Ankit SaxenaPosted Jan 11, 2016, 11:39 PM
Good Info... Thanks for sharing.
Humayun Kabir MamunPosted Jan 11, 2016, 11:01 PM
Nice...
Raja TPosted Jan 11, 2016, 10:41 PM
Nice,thanks for sharing