How to Preview Any File Online with Spring Boot, MinIO, and kkFileView

This tutorial shows how to set up MinIO and the open‑source kkFileView tool using Docker, configure a storage bucket, and generate preview URLs so that any file type—images, Word, PDF, PPT, markdown, Excel, or archives—can be viewed directly in a web browser without writing additional code.

macrozheng
macrozheng
macrozheng
How to Preview Any File Online with Spring Boot, MinIO, and kkFileView

kkFileView Overview

kkFileView is an open‑source online preview project built on Spring Boot, currently with over 21k stars on Gitee. It is easy to deploy and supports preview of almost all common file formats.

Installation

Using Docker to install MinIO and kkFileView is very convenient.

MinIO

Download the MinIO Docker image: docker pull minio/minio Run the MinIO container, exposing the console on port 9001 and the service on port 9090:

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 MinIO console at http://192.168.3.101:9001 using the default credentials minioadmin:minioadmin.

kkFileView

Download the kkFileView Docker image: docker pull keking/kkfileview Run the kkFileView container on port 8012:

docker run -p 8012:8012 --name kkfileview \
  -d keking/kkfileview

Open the kkFileView test page at http://192.168.3.101:8012.

Usage

Now we will demonstrate how to use MinIO and kkFileView together.

Preparation

Create a bucket named preview in MinIO.

Set the bucket's access policy to Public for external access.

Upload files to the bucket.

Files stored in MinIO can be accessed via http://192.168.3.101:9090/{bucketName}/{fileName}. For example, the file avatar.png in the preview bucket is reachable at http://192.168.3.101:9090/preview/avatar.png.

File Preview

We now explain how to preview files from MinIO using kkFileView.

Image

Enter the file name on the kkFileView test page to obtain a preview link.

Preview URL format (base64‑encoded):

http://192.168.3.101:8012/onlinePreview?url=base64Encode($url)

Word

Preview a Word document directly in the browser.

PDF

Preview a PDF document directly in the browser.

PPT

Preview a PowerPoint presentation directly in the browser.

Markdown

Preview a markdown file directly in the browser.

Excel

Preview an Excel file directly in the browser.

Compressed Files

Compressed archives can be opened and their internal files previewed.

Conclusion

This guide demonstrated how to achieve online preview of any file type by combining Spring Boot, MinIO, and kkFileView, without writing additional code. You can apply this setup in projects that require file preview functionality.

Project Repository

https://gitee.com/kekingcn/file-online-preview

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerSpring BootMiniofile previewkkFileView
macrozheng
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.