This project is created based on the GroupDocs.Viewer for .NET library. It helps you quickly discover the library's functionality and build a custom ASP.NET document viewer capable of displaying over 50 types of documents and images, including PDF, Microsoft Word, Excel, PowerPoint, Visio, CAD and TIFF.
Please note: this project is built based on the GroupDocs.Viewer for .NET library which is not free. In order to setup and run the project, you will need to download the GroupDocs.Viewer for .NET library (a free evaluation available) from this page. If you want to test the viewer without any evaluation restrictions, please feel free to contact GroupDocs support for a free 30-day license.
GroupDocs.Viewer for .NET is a lightweight .NET library designed as a client-server middleware that can be integrated into any ASP.NET website. Unlike commonly used client middleware (built based on Adobe Flash, Microsoft Silverlight, Java applet or other similar technologies), GroupDocs.Viewer for .NET doesn’t download original documents to the client-side. Instead, the library converts documents to a combination of HTML, CSS, SVG and raster images on the server and then transfers these to the client-side. When building an ASP.NET document viewer, such architecture provides you with the following benefits:
First, you avoid potential security flaws, as the original documents are not downloaded to the client during viewing sessions – they are just rendered in a browser. In other words, you can securely share your important documents, while keeping them protected from unauthorized use.
The second benefit combines cross-platform compatibility and ease of deployment. Since documents are converted to pure HTML, CSS and images, they can be viewed on any device that has a web-browser with support for HTML/CSS/JavaScript. These could be IE, Chrome, FireFox, Safari, Opera, etc. as well as their mobile versions. You don’t need to install and maintain any 3rd party software on the client-side – no need for Microsoft Office, Adobe Acrobat Reader, Flash or any browser plugins.
Using a single GroupDocs.Viewer for .NET library, you can build a multi-format ASP.NET document viewer capable to display all common types of business documents and images, including:
The library allows you to switch between two document rendering modes: image- and HTML-based.
The image-based mode rasterizes documents to images and sends them to the client. If there is text in the original document, the library extracts it and then renders it in a separate layer on top of the rasterized backgrounds. This mode guarantees 100% accuracy, as documents are simply rasterized and texts are placed exactly where it should be using its initial coordinates from the original file.
However, the main drawback with this method is that when rasterizing large plain documents, such as Microsoft Excel sheets, large plain TXT documents or Outlook messages, the library has to split them into pages forcibly. This behavior is similar to printing such documents, when they are split in order to fit a specified paper size. Without doing so, a rasterized document may be huge and require a lot of RAM and bandwidth to render it on the client-side.
The second, HTML-based rendering mode, converts documents to pure HTML, CSS and scalable SVG images. As a result, documents are much lighter compared to rasterized ones and are not split into pages, but rendered as is. Unfortunately, some old web-browsers don’t support SVG graphics (for example, IE8 and earlier). If this is the case, you can configure GroupDocs.Viewer to replace SVG with PNG images.
Below is a screenshot of a sample XLSX document rendered in the image-based mode. Note how it is split into several pages (you can see them in the thumbnails panel):
Now, the same XLSX document rendered in the HTML-based mode. It is not split into pages, but displayed as is. Also there is a tabbed navigation bar available in this mode allowing users to switch between the Excel sheets that the document contain:
For faster performance, GroupDocs.Viewer adds commonly requested documents to cache. In case a document has been modified on the server, the viewer reloads the cache automatically. There is also an AOT (ahead-of-time) cashing option that allows you to forcibly add a specified document to cache, even before it is requested by users.
Another feature aimed to improve the viewer’s performance and reliability is on-demand page loading. By default, the viewer doesn’t upload an entire document to the browser, but transmits only those pages which were requested by the client at the moment.
The library comes with a web UI that can be fully customized and embed to your ASP.NET app. The UI provides the controls necessary for convenient viewing and navigation of large multi-page documents in a browser. When viewing documents through the UI, end-users can:
Please note that any of these controls, including document downloading, printing and text coping, can be easily restricted or removed at all, depending on your requirements.
As already stated before, this sample project aims to demonstrate the basic functionality of an ASP.NET document viewer built based on the GroupDocs.Viewer for .NET library. You can open this sample in Microsoft Visual Studio 2012 or higher. In order to run the project, you will also need to download the GroupDocs.Viewer for .NET library itself (Groupdocs.Viewer.dll) and place it into the “GroupDocsViewerWebFormsSample\libs” folder. Please use this link to download a free evaluation of the library.
Once this is done, compile and run the project. If everything was done right, you should see a start page (Default.aspx) with a set of documents in your browser.
The sample has a sort of repository (the FileRepository
class) that looks into the “App_Data” folder and returns a list of documents located there. The list is displayed on the start page. We’ve included several sample
documents to the “App_Data” folder. They are: “candy.pdf” and “Sample_2SpreadSheet.xlsx”. You can also add your own documents to the repository and they too will be listed on the start page.
When clicking the Open hyperlink next to a document name, a new page is opened with the document displayed within the GroupDocs.Viewer UI.
There is no need to install anything on the client side. The only requirement is to have a standard web-browser that supports HTML, CSS and JavaScript.
Requirements for the server side are following:
Please note that the GroupDocs.Viewer for .NET library is not free. In order to setup and run the project, you will need to download the GroupDocs.Viewer for .NET library (a free evaluation available) from this page. You can also get a free 30 trial license by contacting the GroupDocs sales. I’d strongly recommend you to do so, as the license allows you to test the viewer without any functional limitations.
For more details on how you can use the library to build an ASP.NET document viewer, as well as for complete documentation and support/sales contacts, please visit GroupDocs website at:
http://groupdocs.com/dot-net/document-viewer-library