Skip to content

groupdocs-viewer/GroupDocs.Viewer-for-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

375 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GroupDocs.Viewer for Java - Examples and Demo Projects

GroupDocs.Viewer for Java is a document viewer API that supports over 170 document formats including Microsoft Office, OpenOffice, PDF, CAD, Photoshop, Visio, images, archives, email messages and more.

Render documents to HTML5, PDF, or image formats with high-quality output. Process documents page-by-page, all at once, or by custom page range. Customize appearance with watermarks, page rotation/reordering, and text extraction with coordinates.

Repository Structure

Directory Description
Demos Demo projects for Spring, Dropwizard, Javalin, Ktor, Micronaut, and Compose Desktop.
Examples Java API usage examples with sample documents.

Demos

All web demos run on http://localhost:8080/viewer/ and provide document viewing with zoom, thumbnails, text search, page rotation, download/upload, and print support.

Demo Framework Language Build Version
Spring Spring Boot 2.5 Java mvn clean spring-boot:run 25.12
Dropwizard Dropwizard 1.3 Java mvn clean compile exec:java 25.12
Javalin Javalin 4.6 Kotlin ./gradlew run 25.12
Ktor Ktor Kotlin ./gradlew run 25.12
Micronaut Micronaut 3.4 Kotlin ./gradlew run 25.12
Compose Compose Desktop Kotlin gradlew run 25.12

The Compose demo is a standalone desktop application (not a web app).

Docker

Pre-built Docker images are available on Docker Hub.

docker pull groupdocs/viewer:latest
docker run -p 8080:8080 groupdocs/viewer:latest

Available image tags follow the pattern {version}-java-{jdk}-bullseye-{framework}:

Tag JDK Framework
{ver}-java-openjdk8-bullseye-spring Eclipse Temurin 8 Spring
{ver}-java-openjdk11-bullseye-spring Eclipse Temurin 11 Spring
{ver}-java-openjdk18-bullseye-spring Eclipse Temurin 21 Spring
{ver}-java-openjdk8-bullseye-dropwizard Eclipse Temurin 8 Dropwizard
{ver}-java-openjdk11-bullseye-dropwizard Eclipse Temurin 11 Dropwizard
{ver}-java-openjdk18-bullseye-dropwizard Eclipse Temurin 21 Dropwizard

The latest tag points to the openjdk18-bullseye-spring variant.

Getting Started

GroupDocs.Viewer for Java requires J2SE 8.0 (1.8) or above.

Add the GroupDocs repository to your Maven project:

<repository>
    <id>GroupDocs Artifact Repository</id>
    <url>https://releases.groupdocs.com/java/repo/</url>
</repository>

Then add the dependency:

<dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-viewer</artifactId>
    <version>25.12</version>
</dependency>

See the installation guide for details.

Code Examples

Render DOCX as Responsive HTML

Viewer viewer = new Viewer("sample.docx");
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
viewOptions.setRenderResponsive(true);
viewer.view(viewOptions);
viewer.close();

View DOCX as Protected PDF

Viewer viewer = new Viewer("sample.docx");
Security security = new Security();
security.setDocumentOpenPassword("o123");
security.setPermissionsPassword("p123");
security.setPermissions(Permissions.ALLOW_ALL ^ Permissions.DENY_PRINTING);

PdfViewOptions viewOptions = new PdfViewOptions(filePath);
viewOptions.setSecurity(security);

viewer.view(viewOptions);
viewer.close();

Licensing

The license is not included in this repository. Without a license, GroupDocs.Viewer runs in evaluation mode. Request a temporary license at https://purchase.groupdocs.com/temporary-license.

Resources

Home | Product Page | Documentation | API Reference | Online Demo | Blog | Free Support | Temporary License

About

GroupDocs.Viewer for Java - Examples and Demo Projects

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages