This web-based PDF viewer sample is created using a commercial library - GroupDocs.Viewer for Java. The sample allows you to:
Before proceeding, please note that GroupDocs.Viewer for Java is a paid library. This sample is created by the GroupDocs team as a showcase. The sample comes with a free evaluation version of the library that has several trial restrictions. If you’d like to test the Java PDF viewer without any limitations, please contact GroupDocs support for a free 30-day license.
There are two main approaches of building a web-based Java PDF viewer. The first is to transfer PDFs to clients and then visualize them in a browser. These types of viewers are usually easy to implement, but have a number of drawbacks. You can’t guarantee security of the displayed PDFs since they are downloaded to user machines. Also, end users are forced to install 3rd party software (e.g. browser plugins) required to view a PDF document.
The second approach is to convert source PDF documents to web-compatible content (HTML markup, CSS, raster or SVG images and JS), transfer it to clients and then render in a web-browser.
GroupDocs.Viewer for Java is a document viewer library developed using this second, client-server (or "thin client") approach. The library accurately converts PDF documents to web compatible content, so that web copies look undistinguished from the original files. The benefits are obvious:
Out-of-the-box Web GUI
GroupDocs.Viewer for Java comes with a customizable web user interface that allows end users to:
A comprehensive API allows you to add/remove toolbars, buttons, tweak UI’s layout & styles and embed it to you Java web app or website. Alternatively, you can build your own GUI from scratch.
Digital Rights Management
Although available by default, the print, download and text copy options can be disabled for all or specific documents, so that they are displayed in a "read-only" mode.
Watermarking
The viewer allows you to render custom watermarks over the displayed PDF documents to protect them from screen grabbing.
Multiple file formats support
In addition to PDF, GroupDocs.Viewer for Java supports Microsoft Word, Excel, PowerPoint, Visio and over 50 other common document and image types.
This sample covers only the core GroupDocs.Viewer for Java functionality. You can use the viewer as is, build a custom Java PDF viewer (or a multi-format document viewer) tailored to your specific needs and seamlessly integrate it into any web app or website. For more details on the library, please visit its homepage and extensive API documentation.
Also, we’ve prepared individual samples for Spring and Servlet. You can download them from this page.