|
1 tydzień temu | |
---|---|---|
.idea | 1 tydzień temu | |
docker | 1 tydzień temu | |
server | 1 tydzień temu | |
.gitattributes | 1 tydzień temu | |
Dockerfile | 1 tydzień temu | |
LICENSE | 1 tydzień temu | |
README.md | 1 tydzień temu | |
pom.xml | 1 tydzień temu |
采用kkFileView
文件文档在线预览解决方案,使用主流的Spring Boot
搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,rar,图片,视频,音频等等
类目 | 版本或建议 |
---|---|
硬件 | 开发电脑建议使用I3及以上CPU,16G及以上内存 |
操作系统 | Windows 10/11,MacOS |
JDK | 默认使用JDK 21,兼容JDK 8/11、JDK17(需调整部分代码),推荐使用 OpenJDK ,如 Liberica JDK 、Eclipse Temurin 、Alibaba Dragonwell 、BiSheng 等发行版; |
Maven | 依赖管理工具,推荐使用 3.6.3 及以上版本 |
IDE | 代码集成开发环境,推荐使用 IDEA2024 及以上版本,兼容 Eclipse 、 Spring Tool Suite 等IDE工具 |
适用于测试或生产环境
类目 | 版本说明或建议 |
---|---|
服务器配置 | 建议至少在 4C/16G/50G 的机器配置下运行; |
操作系统 | 建议使用 Windows Server 2019 及以上版本或主流 Linux 发行版本,推荐使用 Linux 环境;兼容 统信UOS ,OpenEuler ,麒麟服务器版 等信创环境; |
JRE | 默认使用JRE 21,兼容JRE 8/11、JRE17(需调整部分代码);推荐使用 OpenJDK ,如 Liberica JDK 、Eclipse Temurin 、Alibaba Dragonwell 、BiSheng 等发行版; |
Redis | 数据缓存,推荐使用 5.0 及以上版本 |
Apache Maven 3.6.3及以上版本
解决以下依赖无法从公共Maven仓库下载的问题
打开Maven安装目录中的 conf/settings.xml
文件,
在 <servers></servers>
中添加如下内容
<server>
<id>maven-releases</id>
<username>jnpf-user</username>
<password>HLrQ0MA%S1nE</password>
</server>
在 <mirrors></mirrors>
中添加
<mirror>
<id>maven-releases</id>
<mirrorOf>*</mirrorOf>
<name>maven-releases</name>
<url>https://repository.jnpfsoft.com/repository/maven-public/</url>
</mirror>
需要使用下表中的对应分支
项目 | 分支 | 说明 |
---|---|---|
后端(任一后端服务) | ||
jnpf-java-boot | v5.2.x-stable | Java单体后端项目源码 |
jnpf-java-cloud | v5.2.x-stable | Java微服务后端项目源码 |
jnpf-dotnet | v5.2.x-stable | .NET单体后端项目源码 |
jnpf-dotnet-cloud | v5.2.x-stable | .NET微服务后端项目源码 |
LiberOffice
(Windows下已内置,CentOS或Ubuntu下会自动下载安装,MacOS下需要自行安装)
server/src/main/config/application.properties
http://localhost:30090
server/src/main/java/cn/keking/ServerMain
http://localhost:30090
测试页面/server/target
主要有以下几个文件
config/application.properties
,配置参考上述开发环境内容bin
目录,运行startup脚本(首次部署,之后更新及维护都在bin目录下)例如访问地址为 https://java.jnpfsoft.com
,文件预览部署在内网 192.168.0.18
服务器上,需要在 Nginx
中添加反向代理如下
# 文件预览服务
location /FileServer {
proxy_pass 192.168.0.18:30090;
}
# 解决文件预览服务无法加载js,css问题
location ~ /FileServer/*.*\.(js|css)?$ {
proxy_pass 192.168.0.18:30090;
}
修改文件预览配置文件如下两项,打开服务器上的 kkFileView-xxx/configapplication.properties
server.servlet.context-path= ${KK_CONTEXT_PATH:/FileServer}
base.url =https://www.usky.cn/FileServer
1、单文件预览
// 要预览文件的访问地址
let previewUrl = 'http://127.0.0.1:8080/file/test.txt'
// 使用
http://127.0.0.1:30090/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl))
2、http/https下载流url预览
// 要预览文件的访问地址
let previewUrl = 'http://127.0.0.1:8080/filedownload?fileId=1'
// 使用
http://127.0.0.1:30090/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl))
3、更多参考官方文档(https://kkfileview.keking.cn/zh-cn/docs/usage.html
)
1、预览乱码(字体问题)
大部分Linux系统上并没有预装中文字体或字体不全,需要把常用字体拷贝到Linux服务器上,具体操作如下: 下载如下字体包 http://kkfileview.keking.cn/fonts.zip
文件解压完整拷贝到Linux下的 /usr/share/fonts
目录。然后依次执行mkfontscale
、mkfontdir
、fc-cache
使字体生效
特别说明:安装字体前确保Linux服务器已安装 mkfontscale、fontconfig,如未安装运行以下命令
CentOS运行如下命令
yum install mkfontscale fontconfig -y
Ubuntu运行如下命令
sudo apt-get install ttf-mscorefonts-installer fontconfig -y
2、更多问题请参考官方文档说明(https://kkfileview.keking.cn/zh-cn/docs/faq.html
)