GroupDocs.Viewer for Java is an HTML5-based document viewer library designed to make it easy for developers to integrate into their Java apps. The viewer supports more than 50 document and image types, including PDF, Microsoft Word, Excel, PowerPoint, AutoCAD, Visio, etc. Implemented within HTML5 standards, the viewer allows documents to be viewed from any web-enabled device using only a web‑browser.
Let’s now look at the enhancements seen in the latest version of the library (version 2.3):
The application path allows the viewer to link and handle client-server requests correctly. Starting from version 2.2, it is possible to use a relative paths. You can now also choose between three different types of the applicationPath parameter value:
- Absolute path, like:
- Custom URL prefix, like:
Prefix (custom-url) is added to the full application path, including context path ‑ http://127.0.0.1:8080/custom-url
- null value
In this case the viewer uses the default application request URI (for example, http://127.0.0.1:8080/)
- PDF Printing
Thanks to the new usePdfPrinting parameter, you can now print documents directly to PDF. Just set the parameter value to true. In this case, when clicking the Print button, a user gets the document printed out in the PDF format.
- Page Reordering
When the supportPageReordering parameter is set to true, users can change a documents page order by dragging page thumbnails in the left side panel. Please note that this option does not change the original document itself. It is intended to help users conveniently browse and collaborate on documents in the web UI. Also, the page reordering feature currently works in the image-based rendering mode only. Set the useHtmlBasedEngine parameter to false in order to enable the feature.
Protecting documents with watermarks in now also easier. There are two parameters available:
- watermarkText – specifies text for the watermark
- watermarkColor – specifies color of the watermark (6 hex digits, i.e. fb3000)
Watermarks are added in a separate layer over the rendered documents, so that the original files are not modified. If you want to keep your documents safe, please be sure to disable both the Download and Printing options as well. Also, please note that watermarks can be added in the image-based rendering mode only.
Another great feature added in the latest versions of the Java document viewer – support of custom localizations.
In the earlier versions you would have to tweak the viewer’s front-end with your own localization (as described here). Starting from now, you can simply add a localization file. For example, assume we need Portuguese localization. First, we have to create a file called pt-PT.properties and fill it with translated terms:
BookMode=Vista Revista FileName=Nome do Arquivo FitHeight=Ajustar a Altura FitWidth=Ajustar a Largura LoadingYourContent=Carregando conteudo... Modified=Modificado Of=de OpenFile=Abrir Arquivo ParentFolder=Pasta principal ScrollView=Scroll Vertical Search=Pesquisa Size=Tamanho Thumbs=Miniaturas
The localization file name has to be in the following format: <locale>.properties to be recognized with the viewer. Once the file is ready, place it somewhere in the system (G:\Projects\GroupDocs\app\locale) and set the path as the localesPath parameter value:
Please note. This value has to be strictly directory path only. Do not append the locale file name to the path, since GroupDocs.Viewer automatically picks up an appropriate localization for your system. So you can place several localization files in that directory.
- Added support for XPS file format
- Implemented P8 FileNet support
- Added sub-folders navigation. Now you can browse and open any sub-folder content.
For a complete list of changes, please check the release notes in the GroupDocs file archive. The library itself can be downloaded from there.
For more information on the viewer and its features, please visit GroupDocs.Viewer for Java home page.