A web-based document viewer built with GroupDocs.Viewer for Java and Spring Boot 2.5.
Supports viewing 170+ document formats (DOCX, PDF, PPT, XLS, images, CAD, and more) as HTML5 or images. See the full list of supported formats.
This Spring Boot sample is a demonstration application. It is provided to show how GroupDocs.Viewer can be integrated with a web UI.
- Intended for local development and evaluation only
- Not audited or hardened for production deployment
- File upload, download, and document path handling must be reviewed and adapted before any external exposure
When integrating GroupDocs.Viewer into your product, implement your own secure file storage, input validation, and access control — do not copy this demo directly into a public-facing service.
- Java 8 (JDK 1.8)
- Maven 3
git clone https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java.git
cd GroupDocs.Viewer-for-Java/Demos/Spring
mvn clean spring-boot:runOpen http://localhost:8080/viewer/ in your browser.
To debug in IntelliJ IDEA, use mvn clean spring-boot:run -Dspring-boot.run.fork=false.
mvn package -P warDeploy the generated WAR file from target/ to your application server.
Build and run locally:
docker build -t groupdocs-viewer-spring .
mkdir -p DocumentSamples LicensesLinux / macOS:
docker run -p 8080:8080 \
--env application.hostAddress=localhost \
-v $(pwd)/DocumentSamples:/home/groupdocs/app/DocumentSamples \
-v $(pwd)/Licenses:/home/groupdocs/app/Licenses \
groupdocs-viewer-springWindows PowerShell:
docker run -p 8080:8080 `
--env application.hostAddress=localhost `
-v ${PWD}/DocumentSamples:/home/groupdocs/app/DocumentSamples `
-v ${PWD}/Licenses:/home/groupdocs/app/Licenses `
groupdocs-viewer-springPre-built images are also available on Docker Hub. See the main README for available tags.
Edit configuration.yml to adjust settings. Place your license file in the Licenses/ folder or set licensePath in configuration.yml.
For Docker, use logback-spring.xml for logging. To use it locally, add -Dlogback.configurationFile=logback-spring.xml to the run command.
| Option | Type | Default | Description |
|---|---|---|---|
filesDirectory |
String | DocumentSamples |
Directory for uploaded and predefined files (absolute or relative path) |
fontsDirectory |
String | Path to custom fonts directory | |
defaultDocument |
String | Absolute path to document loaded automatically on startup | |
preloadPageCount |
Integer | 0 |
Pages to preload (0 = load all at once) |
htmlMode |
Boolean | true |
true for HTML rendering, false for image rendering |
zoom |
Boolean | true |
Enable document zoom |
search |
Boolean | true |
Enable text search |
thumbnails |
Boolean | true |
Enable thumbnails preview |
rotate |
Boolean | true |
Enable page rotation |
cache |
Boolean | true |
Enable rendering cache |
saveRotateState |
Boolean | true |
Persist page rotation to the file |
watermarkText |
String | Watermark text overlay |
Options can also be set via environment variables, e.g. application.viewer.htmlMode=false.
Note: Without a license, the application runs in evaluation mode. Request a temporary license to test all features.
The MIT License (MIT). See LICENSE for details.
Product Page | Documentation | API Reference | Online Demo | Blog | Free Support | Temporary License