This post will be helpful for those of you who are looking for a Java PDF viewer or a universal document viewer library and have no time/resources for developing it from scratch.
Specifically, in the post I’m going to highlight key benefits and features of a Java PDF viewer which you can build based on the commercial library – GroupDocs.Viewer for Java. Hopefully, the post will be useful for the JavaRanch community, as the library can be seamlessly integrated into any Java app and save tons of time that you would have to spend when developing the PDF viewer yourself. So, here we go:
GroupDocs.Viewer for Java is a universal document viewer library built based on the client-server architecture. It allows you to display PDF, Microsoft Office, Visio, CAD, and over 50 other types of documents. Key features and benefits of the library include:
1. Secure document sharing. Unlike the client-based viewers, which visualize documents on the client side using a Java applet, Adobe Flash, Microsoft Silverlight or similar technologies, GroupDocs.Viewer for Java doesn’t pass original documents to client machines during view sessions. Instead, the library converts documents to a web-compatible content on the server and then renders it in clients’ browsers just like regular web-pages. This protects your content from potential security flaws, as the documents you share are not downloaded to end-user machines.
Combined with the DRM (digital rights management) feature, this allows you to prevent viewers from copying the documents you share. The DRM provides control over user access permissions, so that you can disable the download, print and copy/paste options for all or some of the displayed documents.
Also, to protect your documents from screen-grabbing, you can add watermarks. The watermarks are rendered over documents on the client-side, so that your original documents stay intact.
2. Zero footprint + cross-platform compatibility. Since the library converts documents to a web-compatible content, documents can be rendered in any modern web-browser, including IE8+, Safari5+, Chrome, FireFox and Opera. There is no need to install anything on the client side. End users can view PDF documents, for example, without having to install Adobe Acrobat Reader or any other plugins.
Furthermore, GroupDocs.Viewer for Java doesn’t have any 3rd party dependencies. So, no need to install any office software on the server too. The library comes as JAR package and can be easily integrated into your app hosted on any Java servlet container.
3. Different document rendering modes. GroupDocs.Viewer for Java allows you to choose between image-based and HTML-based document rendering modes. In the image-based mode, the library converts documents to raster images. When displaying textual documents, like PDF files, the library also extracts text and then renders it in a separate layer over the rasterized background. As a result, the final documents look sharp even when zooming in/out of the document.
Native text rendering also means that users can select and copy it to the clipboard right from documents displayed in a browser (this option can be disabled with the DRM feature).
The image-based mode has its drawbacks though. For example, when rasterizing a large PDF document that has a lot of pages, the rasterized copy may be quite heavy and require a decent bandwidth along with RAM and disk space to store it. This is where the HTML-based document rendering mode comes in handy.
When switched to the HTML-based rendering mode, GroupDocs.Viewer for Java converts documents to HTML markup, CSS and scalable SVG images. In the output you get much lighter content (as opposite to the rasterized documents) that needs to be transferred to clients.
4. Out-of-the-box UI. GroupDocs.Viewer for Java comes with a web UI which provides end users with controls for seamless navigation of multi-page documents in a browser. When viewing document through the UI, end users can:
Turn document pages like slides
Preview/navigate pages with thumbnails
Jump straight to the specified page
Search for text within the document
Select and copy text to the clipboard
Zoom in/out of the document
Print or download the original document
As already mentioned, the print, download and text copy/paste options can be disabled, so that documents are displayed in a “read-only” mode. Alternatively, the library allows you to convert your documents to the PDF format, so that users can get only a PDF copy of the original document upon download.
5. Support for PDF, Microsoft Office and 50+ other document types. Along with PDF files, the library allows you to display documents of the following formats:
.doc(x), .docm, .dot, .dotx, .dotm
.xls(x), .xlsm, .xlsb, .xml
.ppt(x), .pps, .ppsx
.vsd, .vdx, .vss, .vsx, .vst, .vtx, .vsdx, .vdw
.eml, .msg, .emlx, .mht
.ods, .odt, .ott, .odp
.html, .mht, .mhtml
.dxf, .dwg (2004)
For more details on the GroupDocs.Viewer for Java library, please visit its homepage. We offer a free evaluation copy of the library that has several functional restrictions. Alternatively, you can contact our support for a free 30-day license to be able to explore the library without any restrictions. We also prepared a demo to help you get started quickly and build your custom Java PDF viewer based on it.