How to Build a Powerful File Preview Service with kkFileView and SpringBoot
This guide walks you through setting up kkFileView—a SpringBoot‑based file preview tool—on Windows or Linux (Docker), configuring it to work with MinIO, and using it to preview a wide range of document, image, video, and archive formats via simple base64‑encoded URLs.
kkFileView Overview
kkFileView is an open‑source SpringBoot application (over 5.7k stars on GitHub) that provides online preview for common office documents such as DOCX, XLSX, PPTX, PDF, TXT, ZIP, images, videos, and audio files.
Installation
Windows
Download the latest release package from the official repository.
Extract it to a directory and run bin/startup.bat to start the service.
To modify configuration, edit config/application.properties inside the project.
Linux (Docker)
Pull the Docker image: docker pull keking/kkfileview Run the container on port 8012:
docker run -p 8012:8012 --name kkfileview \
-d keking/kkfileviewUsage with MinIO
Store files in a MinIO bucket (e.g., preview) using a client such as S3 Browser, then set the bucket policy to allow anonymous access.
To preview a file, call the online preview endpoint with a base64‑encoded file URL:
http://<span>$host</span>:8012/onlinePreview?url=base64Encode($url)Examples include previewing images, Word documents (converted to PDF or JPG), PPT files, PDFs, Excel sheets, Markdown text, and ZIP archives.
Configuration
The main configuration resides in config/application.properties. To customize Docker settings, copy the config directory from the container:
docker cp kkfileview:/opt/kkFileView-3.5.1/config /mydata/kkFileView/configThen mount the config, 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 watermark.txt=${WATERMARK_TXT:macrozheng} in the properties file.
Summary
kkFileView provides a simple, out‑of‑the‑box solution for online preview of office documents, images, videos, and archives. By converting files to PDF or JPG, it meets most preview needs without complex setup, making it ideal for building a universal file preview service.
Reference
Official documentation: https://kkfileview.keking.cn/zh-cn/index.html
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.
