kkFileView
1、简介
此项目为文件文档在线预览项目解决方案,对标业内付费产品有【永中office】【office365】【idocv】等,在取得公司高层同意后以Apache协议开源出来反哺社区,在此特别感谢@唐老大的支持以及@端木详笑的贡献。该项目使用流行的spring boot搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,Excel,pdf,txt,zip,rar,图片等等
2、安装部署
官方网址:https://kkfileview.keking.cn/zh-cn/index.html
码云:https://gitee.com/kekingcn/file-online-preview
ubuntu中安装
使用docker进行安装部署
1 | #使用docker安装 |

修改配置文件
1 | #获取application.properties文件位置 |
mac中部署
先安装:https://www.openoffice.org/download/

- 第一种:使用docker进行安装部署
- 第二种:在码云中下载已经编译好的安装包

进入bin目录下使用startup.sh

访问8012端口

- 第三种:下载最新版本的源码,自己进行编译安装
3、使用
js中使用
1 | <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/js-base64@3.6.0/base64.min.js"></script> |
SpringBoot中使用
使用Thymeleaf返回页面
添加依赖
1
2
3
4<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>配置properties
1
2
3
4
5
6spring.thymeleaf.prefix=classpath:/templates/
spring.mvc.static-path-pattern=/**
spring.resources.static-locations=classpath:/static/
spring.thymeleaf.cache=false编写html页面(**重要**)


4、中文显示乱码
下载常用的字体:http://kkfileview.keking.cn/fonts.zip
解压放入到/usr/share/fonts目录中

1 | #使字体生效,若提示未安装相关命令,则安装即可 |
评论