How to Set Up kkFileView for Instant File Preview with Docker and SpringBoot
This guide walks you through installing kkFileView on Windows and Linux, integrating it with MinIO for online file preview, configuring Docker containers, and customizing settings such as watermarks, providing step‑by‑step instructions and code snippets for a seamless preview service.
In a previous article we used MinIO for object storage; now we introduce kkFileView, a SpringBoot‑based service that enables online preview of various file formats.
kkFileView Overview
kkFileView is an open‑source file preview solution (5.7k+ stars on GitHub) built with SpringBoot, supporting documents like docx, xlsx, pptx, pdf, txt, zip, images, video, audio, etc.
Installation
Windows
Download the latest release package from the official repository.
Extract it to a directory and run startup.bat in the bin folder.
To modify configuration, edit the application.properties file under the config directory.
Linux
Pull the Docker image: docker pull keking/kkfileview Run the container on port 8012:
docker run -p 8012:8012 --name kkfileview \
-d keking/kkfileviewAccess the test page at http://<your_ip>:8012.
Usage
After storing files in MinIO (e.g., in a bucket named preview), obtain the file URL, base64‑encode it, and call the preview endpoint:
http://<your_ip>:8012/onlinePreview?url=base64Encode($url)Examples include previewing images, Word documents (converted to PDF or JPG), PPT, PDF, Excel, Markdown, and compressed files.
Configuration
Configuration files reside in the config directory. To edit them from a Docker container:
docker cp kkfileview:/opt/kkFileView-3.5.1/config /mydata/kkFileView/Mount the configuration, file, and log directories when running the container:
docker run -p 8012:8012 --name kkfileview \
-v /mydata/kkFileView/config:/opt/kkFileView-3.5.1/config \
-v /mydata/kkFileView/file:/opt/kkFileView-3.5.1/file \
-v /mydata/kkFileView/log:/opt/kkFileView-3.5.1/log \
-d keking/kkfileviewTo add a watermark, set the watermark.txt property in application.properties:
# Watermark content
# To disable, set empty: watermark.txt = ${WATERMARK_TXT:}
watermark.txt = ${WATERMARK_TXT:macrozheng}Summary
kkFileView provides a simple way to preview Office documents, images, videos, and more; it converts Word and PPT files to PDF or JPG for display, making it a versatile solution for building an all‑in‑one online file preview service.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
