How to Enable Any File Online Preview with Spring Boot, MinIO, and kkFileView
This tutorial walks through installing MinIO and kkFileView via Docker, configuring a public bucket, and using SpringBoot to generate preview URLs that let you view images, Word, PDF, PPT, Markdown, Excel, and archive files directly in the browser.
kkFileView Overview
kkFileView is an open‑source universal online preview project built on SpringBoot, currently with over 21k stars on Gitee. It is easy to set up and supports preview of almost all common file types.
Installation
Using Docker to install MinIO and kkFileView is convenient.
MinIO
Pull the MinIO Docker image: docker pull minio/minio Run the MinIO container, exposing port 9001 for the console and 9090 for the service:
docker run -p 9090:9000 -p 9001:9001 --name minio \
-v /mydata/minio/data:/data \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
-d minio/minio server /data --console-address ":9001"Access the console at http://192.168.3.101:9001 using the default credentials minioadmin:minioadmin.
kkFileView
Pull the kkFileView Docker image: docker pull keking/kkfileview Run the kkFileView container on port 8012:
docker run -p 8012:8012 --name kkfileview \
-d keking/kkfileviewOpen the kkFileView test page at http://192.168.3.101:8012.
Usage
Now we explain how to use MinIO and kkFileView together.
Preparation
Create a bucket named preview in MinIO.
Set the bucket policy to Public for external access.
Upload files to the bucket.
Files can be accessed via http://192.168.3.101:9090/{bucketName}/{fileName}. For example, http://192.168.3.101:9090/preview/avatar.png.
File Preview
Use kkFileView to preview files stored in MinIO.
Image
Open the kkFileView preview page, enter the file name, and obtain the preview link.
Preview URL format:
http://192.168.3.101:8012/onlinePreview?url=base64Encode($url)Word, PDF, PPT, Markdown, Excel, Archive
Examples of previewing these file types are shown in the original article (images omitted for brevity).
Conclusion
This guide demonstrates how to achieve online preview of any file with SpringBoot, MinIO, and kkFileView without writing additional code.
Project Repository
https://gitee.com/kekingcn/file-online-preview
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.
Su San Talks Tech
Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.
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.
