Skip to content

Latest commit

 

History

History

README.md

GroupDocs.Viewer for Java - Spring Boot Demo

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.

System Requirements

  • Java 8 (JDK 1.8)
  • Maven 3

How to Run

git clone https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java.git
cd GroupDocs.Viewer-for-Java/Demos/Spring
mvn clean spring-boot:run

Open http://localhost:8080/viewer/ in your browser.

To debug in IntelliJ IDEA, use mvn clean spring-boot:run -Dspring-boot.run.fork=false.

Build WAR

mvn package -P war

Deploy the generated WAR file from target/ to your application server.

Docker

Build and run locally:

docker build -t groupdocs-viewer-spring .
mkdir -p DocumentSamples Licenses

Linux / 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-spring

Windows 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-spring

Pre-built images are also available on Docker Hub. See the main README for available tags.

Configuration

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.

License

The MIT License (MIT). See LICENSE for details.

Resources

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