My first thought when we were planning the project was to go with something like Google Docs Viewer or a similar solution, but since the application will be running on the clients intranet, this was a no go. Neither the application nor the documents are allowed to be exposed to the internet.
- Work on a Windows Server and with .NET.
- Support for PDF, both new and old MS Office formats.
- Printing without leaving the touch application context.
- Preferably support reading the documents from a URL or .NET stream.
- No extra plugins to be installed on the client computers.
The next step was start doing some research. I quickly ruled out writing everything from scratch as this would be a too big task in this project. So then we were left with the question, is there a product out there, that could offer us a clean and simple document viewing solution and meet our criteria?
It turned out to be a bit harder than expected to find good candidates. Most other use cases I could dig up used cloud solutions, but after some intensive searching, I ended up with three that looked promising.
Met most of our criteria, supports a vast array of formats, but had some drawbacks. It needs a seperate server installed to do the document translation. And judging by the example project they offer for download, it requires a lot of code written in order to make it tick. In addition to this it only offers the possibility to load the document from a file path.
Has to run as a separate website on the server, possible to extend how you load the documents by adding a provider, supports from file and URL in the example project. Though my testing with the URL fetching didn't always work so well. I also found the UI a bit too crowded and had a lot of features we just didn't need.
Though these two products probably would have done the job just fine, the third one I tested was the standout of the three and the one I went on to use.
- It is lightweight compared to the others, just add one DLL
- It has a very clean and simple API.
- Initially didn't support the printing solution we wanted, but after talking to them and explaining the functionality we needed, they quickly came out with a new version that solved it.
To use the GroupDocs Viewer in a ASP.NET MVC application there is four steps you have to go through.
Reference the dll into the project.
Add the following to Global.asax.
Add some handlers to your web.config file.
Final step is to add the following to your view.
After implementing and using Groupdocs Viewer in the project it looks to be working very well. I have tested with a lot of documents and so far so good. Everything I've thrown at it renders nicely and looks just as good as it would in a PDF viewer or MS Word.
![Example of the end product](/content/images/2014/10/smalleraskotouchgroupdocs.png)