mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-30 12:06:46 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4af19dd646 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -17,6 +17,7 @@ target/
|
|||||||
|
|
||||||
### NetBeans ###
|
### NetBeans ###
|
||||||
nbproject/private/
|
nbproject/private/
|
||||||
|
build/
|
||||||
nbbuild/
|
nbbuild/
|
||||||
dist/
|
dist/
|
||||||
nbdist/
|
nbdist/
|
||||||
@@ -26,5 +27,5 @@ nbdist/
|
|||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
server/src/main/cache/
|
jodconverter-web/src/main/cache/
|
||||||
server/src/main/file/
|
jodconverter-web/src/main/file/
|
||||||
|
|||||||
25
Dockerfile
25
Dockerfile
@@ -1,7 +1,7 @@
|
|||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
MAINTAINER chenjh "842761733@qq.com"
|
MAINTAINER chenjh "842761733@qq.com"
|
||||||
ADD server/target/kkFileView-*.tar.gz /opt/
|
ADD jodconverter-web/target/kkFileView-*.tar.gz /opt/
|
||||||
COPY fonts/* /usr/share/fonts/chinese/
|
COPY fonts/* /usr/share/fonts/chienes/
|
||||||
RUN echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" > /etc/apt/sources.list &&\
|
RUN echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ndeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" > /etc/apt/sources.list &&\
|
||||||
apt-get clean && apt-get update &&\
|
apt-get clean && apt-get update &&\
|
||||||
apt-get install -y locales && apt-get install -y language-pack-zh-hans &&\
|
apt-get install -y locales && apt-get install -y language-pack-zh-hans &&\
|
||||||
@@ -14,21 +14,12 @@ RUN echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe m
|
|||||||
apt-get install xfonts-wqy &&\
|
apt-get install xfonts-wqy &&\
|
||||||
cd /tmp &&\
|
cd /tmp &&\
|
||||||
wget https://kkfileview.keking.cn/server-jre-8u251-linux-x64.tar.gz &&\
|
wget https://kkfileview.keking.cn/server-jre-8u251-linux-x64.tar.gz &&\
|
||||||
|
wget https://kkfileview.keking.cn/Apache_OpenOffice_4.1.6_Linux_x86-64_install-deb_zh-CN.tar.gz -cO openoffice_deb.tar.gz &&\
|
||||||
tar -zxf /tmp/server-jre-8u251-linux-x64.tar.gz && mv /tmp/jdk1.8.0_251 /usr/local/ &&\
|
tar -zxf /tmp/server-jre-8u251-linux-x64.tar.gz && mv /tmp/jdk1.8.0_251 /usr/local/ &&\
|
||||||
|
tar -zxf /tmp/openoffice_deb.tar.gz && cd /tmp/zh-CN/DEBS &&\
|
||||||
# 安装 OpenOffice
|
dpkg -i *.deb && dpkg -i desktop-integration/openoffice4.1-debian-menus_4.1.6-9790_all.deb &&\
|
||||||
# wget https://kkfileview.keking.cn/Apache_OpenOffice_4.1.6_Linux_x86-64_install-deb_zh-CN.tar.gz -cO openoffice_deb.tar.gz &&\
|
|
||||||
# tar -zxf /tmp/openoffice_deb.tar.gz && cd /tmp/zh-CN/DEBS &&\
|
|
||||||
# dpkg -i *.deb && dpkg -i desktop-integration/openoffice4.1-debian-menus_4.1.6-9790_all.deb &&\
|
|
||||||
|
|
||||||
# 安装 libreoffice
|
|
||||||
apt-get install -y libxinerama1 libcairo2 libcups2 libx11-xcb1 &&\
|
|
||||||
wget https://kkfileview.keking.cn/LibreOffice_7.1.4_Linux_x86-64_deb.tar.gz -cO libreoffice_deb.tar.gz &&\
|
|
||||||
tar -zxf /tmp/libreoffice_deb.tar.gz && cd /tmp/LibreOffice_7.1.4.2_Linux_x86-64_deb/DEBS &&\
|
|
||||||
dpkg -i *.deb &&\
|
|
||||||
|
|
||||||
rm -rf /tmp/* && rm -rf /var/lib/apt/lists/* &&\
|
rm -rf /tmp/* && rm -rf /var/lib/apt/lists/* &&\
|
||||||
cd /usr/share/fonts/chinese &&\
|
cd /usr/share/fonts/chienes &&\
|
||||||
mkfontscale &&\
|
mkfontscale &&\
|
||||||
mkfontdir &&\
|
mkfontdir &&\
|
||||||
fc-cache -fv
|
fc-cache -fv
|
||||||
@@ -37,5 +28,5 @@ ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
|||||||
ENV PATH $PATH:$JAVA_HOME/bin
|
ENV PATH $PATH:$JAVA_HOME/bin
|
||||||
ENV LANG zh_CN.UTF-8
|
ENV LANG zh_CN.UTF-8
|
||||||
ENV LC_ALL zh_CN.UTF-8
|
ENV LC_ALL zh_CN.UTF-8
|
||||||
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.0.0/bin
|
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.2.1/bin
|
||||||
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.0.0/config/application.properties","-jar","/opt/kkFileView-4.0.0/bin/kkFileView-4.0.0.jar"]
|
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-2.2.1/config/application.properties","-jar","/opt/kkFileView-2.2.1/bin/kkFileView-2.2.1.jar"]
|
||||||
85
README.md
85
README.md
@@ -2,12 +2,12 @@
|
|||||||
此项目为文件文档在线预览项目解决方案,对标业内付费产品有【[永中office](http://dcs.yozosoft.com/)】【[office365](http://www.officeweb365.com/)】【[idocv](https://www.idocv.com/)】等,在取得公司高层同意后以Apache协议开源出来反哺社区,在此特别感谢@唐老大的支持以及@端木详笑的贡献。该项目使用流行的spring boot搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,Excel,pdf,txt,zip,rar,图片等等
|
此项目为文件文档在线预览项目解决方案,对标业内付费产品有【[永中office](http://dcs.yozosoft.com/)】【[office365](http://www.officeweb365.com/)】【[idocv](https://www.idocv.com/)】等,在取得公司高层同意后以Apache协议开源出来反哺社区,在此特别感谢@唐老大的支持以及@端木详笑的贡献。该项目使用流行的spring boot搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,Excel,pdf,txt,zip,rar,图片等等
|
||||||
### 项目特性
|
### 项目特性
|
||||||
|
|
||||||
1. 支持 office, pdf, cad 等办公文档
|
1. 支持office,pdf, cad等办公文档
|
||||||
1. 支持 txt, xml(渲染), md(渲染), java, php, py, js, css 等所有纯文本
|
1. 支持txt,java,php,py,md,js,css等所有纯文本
|
||||||
1. 支持zip,rar,jar,tar,gzip等压缩包
|
1. 支持zip,rar,jar,tar,gzip等压缩包
|
||||||
1. 支持 jpg, jpeg, png, gif, tif, tiff 等图片预览(翻转,缩放,镜像)
|
1. 支持jpg,jpeg,png,gif等图片预览(翻转,缩放,镜像)
|
||||||
1. 使用 spring-boot 开发,预览服务搭建部署非常简便
|
1. 使用spring boot开发,预览服务搭建部署非常简便
|
||||||
1. rest 接口提供服务,跨语言、跨平台特性(java,php,python,go,php,....)都支持,应用接入简单方便
|
1. rest接口提供服务,跨平台特性(java,php,python,go,php,....)都支持,应用接入简单方便
|
||||||
1. 抽象预览服务接口,方便二次开发,非常方便添加其他类型文件预览支持
|
1. 抽象预览服务接口,方便二次开发,非常方便添加其他类型文件预览支持
|
||||||
1. 最最重要Apache协议开源,代码pull下来想干嘛就干嘛
|
1. 最最重要Apache协议开源,代码pull下来想干嘛就干嘛
|
||||||
|
|
||||||
@@ -99,79 +99,16 @@ pdf预览模式预览效果如下
|
|||||||
- jodconverter
|
- jodconverter
|
||||||
> 依赖外部环境
|
> 依赖外部环境
|
||||||
- redis (可选,默认不用)
|
- redis (可选,默认不用)
|
||||||
- OpenOffice 或者 LibreOffice( Windows 下已内置,Linux 脚本启动模式会自动安装,Mac OS 下需要手动安装)
|
- OpenOffice或者LibreOffice(Windows下已内置,Linux会自动安装,Mac OS下需要手动安装)
|
||||||
|
|
||||||
1. 第一步:pull项目https://github.com/kekingcn/file-online-preview.git
|
1. 第一步:pull项目https://github.com/kekingcn/file-online-preview.git
|
||||||
|
|
||||||
3. 第二步:运行 ServerMain 的 main 方法,服务启动后,访问 http://localhost:8012/
|
3. 第二步:运行FilePreviewApplication的main方法,服务启动后,访问http://localhost:8012/
|
||||||
会看到如下界面,代表服务启动成功
|
会看到如下界面,代表服务启动成功
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 历史更新记录
|
### 历史更新记录
|
||||||
|
|
||||||
> 2021年7月6日,v4.0.0 版本发布 :
|
|
||||||
|
|
||||||
1. 底层集成OpenOffice替换为LibreOffice,Office文件兼容性增强,预览效果提升
|
|
||||||
2. 修复压缩文件目录穿越漏洞
|
|
||||||
3. 修复PPT预览使用PDF模式无效
|
|
||||||
4. 修复PPT图片预览模式前端显示异常
|
|
||||||
5. 新增功能:首页文件上传功能可通过配置实时开启或禁用
|
|
||||||
6. 优化增加Office进程关闭日志
|
|
||||||
7. 优化Windows环境下,查找Office组件逻辑(内置的LibreOffice优先)
|
|
||||||
8. 优化启动Office进程改同步执行
|
|
||||||
|
|
||||||
> 2021年6月17日,v3.6.0 版本发布 :
|
|
||||||
|
|
||||||
ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献,感谢 @gaoxingzaq、@zhangxiaoxiao9527 的代码贡献
|
|
||||||
1. 新增 ofd 类型文件预览支持,ofd 是国产的类似 pdf 格式的文件
|
|
||||||
2. 新增了 ffmpeg 视频文件转码预览支持,打开转码功能后,理论上支持所有主流视频的预览,如 rm、rmvb、flv 等
|
|
||||||
3. 美化了 ppt、pptx 类型文件预览效果,比之前版本好看太多
|
|
||||||
4. 更新了 pdfbox、xstream、common-io 等依赖的版本
|
|
||||||
|
|
||||||
> 2021年1月28日 :
|
|
||||||
|
|
||||||
2020农历年最后一个版本发布,主要包含了部分 UI 改进,和解决了 QQ 群友、 Issue 里反馈的 Bug 修复,最最重要的是发个新版,过个好年
|
|
||||||
|
|
||||||
1. 引入galimatias,解决不规范文件名导致文件下载异常
|
|
||||||
2. 更新index接入演示界面UI风格
|
|
||||||
3. 更新markdown文件预览UI风格
|
|
||||||
4. 更新XML文件预览UI风格,调整类文本预览架构,更方便扩展
|
|
||||||
5. 更新simTxT文件预览UI风格
|
|
||||||
6. 调整多图连续预览上下翻图的UI
|
|
||||||
7. 采用apache-common-io包简化所有的文件下载io操作
|
|
||||||
8. XML文件预览支持切换纯文本模式
|
|
||||||
9. 增强url base64解码失败时的提示信息
|
|
||||||
10. 修复导包错误以及图片预览 bug
|
|
||||||
11. 修复发行包运行时找不到日志目录的问题
|
|
||||||
12. 修复压缩包内多图连续预览的bug
|
|
||||||
13. 修复大小写文件类型后缀没通用匹配的问题
|
|
||||||
14. 指定Base64转码采用Apache Commons-code中的实现,修复base64部分jdk版本下出现的异常
|
|
||||||
15. 修复类文本类型HTML文件预览的bug
|
|
||||||
16. 修复:dwg文件预览时无法在jpg和pdf两种类型之间切换
|
|
||||||
17. escaping of dangerous characters to prevent reflected xss
|
|
||||||
18. 修复重复编码导致文档转图片预览失败的问题&编码规范
|
|
||||||
|
|
||||||
> 2020年12月27日 :
|
|
||||||
|
|
||||||
2020年年终大版本更新,架构全面设计,代码全面重构,代码质量全面提升,二次开发更便捷,欢迎拉源码品鉴,提issue、pr共同建设
|
|
||||||
|
|
||||||
1. 架构模块调整,大量的代码重构,代码质量提升N个等级,欢迎品鉴
|
|
||||||
2. 增强XML文件预览效果,新增XML文档数结构预览
|
|
||||||
3. 新增markdown文件预览支持,预览支持md渲染和源文本切换支持
|
|
||||||
4. 切换底层web server为jetty,解决这个issue:https://github.com/kekingcn/kkFileView/issues/168
|
|
||||||
5. 引入cpdetector,解决文件编码识别问题
|
|
||||||
6. url采用base64+urlencode双编码,彻底解决各种奇葩文件名预览问题
|
|
||||||
7. 新增配置项office.preview.switch.disabled,控制offic文件预览切换开关
|
|
||||||
8. 优化文本类型文件预览逻辑,采用Base64传输内容,避免预览时再次请求文件内容
|
|
||||||
9. office预览图片模式禁用图片放大效果,达到图片和pdf预览效果一致的体验
|
|
||||||
10. 直接代码静态设置pdfbox兼容低版本jdk,在IDEA中运行也不会有警告提示
|
|
||||||
11. 移除guava、hutool等非必须的工具包,减少代码体积
|
|
||||||
12. Office组件加载异步化,提速应用启动速度最快到5秒内
|
|
||||||
13. 合理设置预览消费队列的线程数
|
|
||||||
14. 修复压缩包里文件再次预览失败的bug
|
|
||||||
15. 修复图片预览的bug
|
|
||||||
|
|
||||||
> 2020年05月20日 :
|
> 2020年05月20日 :
|
||||||
1. 新增支持全局水印,并支持通过参数动态改变水印内容
|
1. 新增支持全局水印,并支持通过参数动态改变水印内容
|
||||||
2. 新增支持CAD文件预览
|
2. 新增支持CAD文件预览
|
||||||
@@ -228,11 +165,3 @@ ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献
|
|||||||
### 使用登记
|
### 使用登记
|
||||||
如果这个项目解决了你的实际问题,可在https://gitee.com/kekingcn/file-online-preview/issues/IGSBV
|
如果这个项目解决了你的实际问题,可在https://gitee.com/kekingcn/file-online-preview/issues/IGSBV
|
||||||
登记下,如果节省了你的三方预览服务费用,也愿意支持下的话,可点击下方【捐助】请作者喝杯咖啡,也是非常感谢
|
登记下,如果节省了你的三方预览服务费用,也愿意支持下的话,可点击下方【捐助】请作者喝杯咖啡,也是非常感谢
|
||||||
|
|
||||||
### Stars 趋势图
|
|
||||||
#### Gitee
|
|
||||||
[](https://whnb.wang/kekingcn/file-online-preview?e=86400)
|
|
||||||
|
|
||||||
#### GitHub
|
|
||||||
|
|
||||||
[](https://starchart.cc/kekingcn/kkFileView)
|
|
||||||
|
|||||||
160
jodconverter-core/pom.xml
Normal file
160
jodconverter-core/pom.xml
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>cn.keking</groupId>
|
||||||
|
<artifactId>jodconverter-core</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<!-- required for org.hyperic:sigar -->
|
||||||
|
<id>jboss-public-repository-group</id>
|
||||||
|
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>juh</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>ridl</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>unoil</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<!-- for the command line tool -->
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>1.1</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hyperic</groupId>
|
||||||
|
<artifactId>sigar</artifactId>
|
||||||
|
<version>1.6.5.132</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20090211</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testng</groupId>
|
||||||
|
<artifactId>testng</artifactId>
|
||||||
|
<version>6.0.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<!-- 要将源码放上去,需要加入这个插件 -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
<configuration>
|
||||||
|
<attach>true</attach>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.3.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.7.2</version>
|
||||||
|
<configuration>
|
||||||
|
<!-- don't run tests in parallel -->
|
||||||
|
<perCoreThreadCount>false</perCoreThreadCount>
|
||||||
|
<threadCount>1</threadCount>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>org.artofsolving.jodconverter.cli.Convert</mainClass>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>2.2-beta-5</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/dist.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
<!-- distribute目录 -->
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>repo</id>
|
||||||
|
<name>User Project Releases</name>
|
||||||
|
<url>http://192.168.1.204:8081/nexus/content/repositories/releases</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>repo</id>
|
||||||
|
<name>User Project SNAPSHOTS</name>
|
||||||
|
<url>http://192.168.1.204:8081/nexus/content/repositories/snapshots</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
|
</project>
|
||||||
@@ -19,7 +19,6 @@ import java.util.Iterator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.artofsolving.jodconverter.util.ConfigUtils;
|
|
||||||
import org.artofsolving.jodconverter.util.PlatformUtils;
|
import org.artofsolving.jodconverter.util.PlatformUtils;
|
||||||
|
|
||||||
import com.sun.star.beans.PropertyValue;
|
import com.sun.star.beans.PropertyValue;
|
||||||
@@ -56,7 +55,7 @@ public class OfficeUtils {
|
|||||||
Map<String,Object> subProperties = (Map<String,Object>) value;
|
Map<String,Object> subProperties = (Map<String,Object>) value;
|
||||||
value = toUnoProperties(subProperties);
|
value = toUnoProperties(subProperties);
|
||||||
}
|
}
|
||||||
propertyValues[i++] = property(entry.getKey(), value);
|
propertyValues[i++] = property((String) entry.getKey(), value);
|
||||||
}
|
}
|
||||||
return propertyValues;
|
return propertyValues;
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,7 @@ public class OfficeUtils {
|
|||||||
|
|
||||||
public static File getDefaultOfficeHome() {
|
public static File getDefaultOfficeHome() {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
String customizedConfigPath = ConfigUtils.getCustomizedConfigPath();
|
String customizedConfigPath = getCustomizedConfigPath();
|
||||||
try {
|
try {
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(customizedConfigPath));
|
BufferedReader bufferedReader = new BufferedReader(new FileReader(customizedConfigPath));
|
||||||
properties.load(bufferedReader);
|
properties.load(bufferedReader);
|
||||||
@@ -81,16 +80,15 @@ public class OfficeUtils {
|
|||||||
}
|
}
|
||||||
if (PlatformUtils.isWindows()) {
|
if (PlatformUtils.isWindows()) {
|
||||||
// %ProgramFiles(x86)% on 64-bit machines; %ProgramFiles% on 32-bit ones
|
// %ProgramFiles(x86)% on 64-bit machines; %ProgramFiles% on 32-bit ones
|
||||||
String officePluginPath = ConfigUtils.getOfficePluginPath();
|
String homePath = OfficeUtils.getHomePath();
|
||||||
String programFiles = System.getenv("ProgramFiles(x86)");
|
String programFiles = System.getenv("ProgramFiles(x86)");
|
||||||
if (programFiles == null) {
|
if (programFiles == null) {
|
||||||
programFiles = System.getenv("ProgramFiles");
|
programFiles = System.getenv("ProgramFiles");
|
||||||
}
|
}
|
||||||
return findOfficeHome(
|
return findOfficeHome(
|
||||||
officePluginPath + File.separator + "windows-office",
|
|
||||||
programFiles + File.separator + "LibreOffice",
|
|
||||||
programFiles + File.separator + "OpenOffice 4",
|
programFiles + File.separator + "OpenOffice 4",
|
||||||
programFiles + File.separator + "LibreOffice 4"
|
programFiles + File.separator + "LibreOffice 4",
|
||||||
|
homePath + File.separator + "office"
|
||||||
);
|
);
|
||||||
} else if (PlatformUtils.isMac()) {
|
} else if (PlatformUtils.isMac()) {
|
||||||
return findOfficeHome(
|
return findOfficeHome(
|
||||||
@@ -104,9 +102,6 @@ public class OfficeUtils {
|
|||||||
"/opt/openoffice.org3",
|
"/opt/openoffice.org3",
|
||||||
"/opt/openoffice",
|
"/opt/openoffice",
|
||||||
"/opt/libreoffice",
|
"/opt/libreoffice",
|
||||||
"/opt/libreoffice6.1",
|
|
||||||
"/opt/libreoffice7.0",
|
|
||||||
"/opt/libreoffice7.1",
|
|
||||||
"/opt/openoffice4",
|
"/opt/openoffice4",
|
||||||
"/usr/lib/openoffice",
|
"/usr/lib/openoffice",
|
||||||
"/usr/lib/libreoffice"
|
"/usr/lib/libreoffice"
|
||||||
@@ -132,7 +127,30 @@ public class OfficeUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getHomePath() {
|
||||||
|
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
||||||
|
if (userDir == null) {
|
||||||
|
userDir = System.getProperty("user.dir");
|
||||||
|
}
|
||||||
|
if (userDir.endsWith("bin")) {
|
||||||
|
userDir = userDir.substring(0, userDir.length() - 4);
|
||||||
|
} else {
|
||||||
|
String separator = File.separator;
|
||||||
|
if (userDir.contains("jodconverter-web")) {
|
||||||
|
userDir = userDir + separator + "src" + separator + "main";
|
||||||
|
} else {
|
||||||
|
userDir = userDir + separator + "jodconverter-web" + separator + "src" + separator + "main";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCustomizedConfigPath() {
|
||||||
|
String homePath = OfficeUtils.getHomePath();
|
||||||
|
String separator = java.io.File.separator;
|
||||||
|
String configFilePath = homePath + separator + "config" + separator + "application.properties";
|
||||||
|
return configFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SpringBoot application.properties 支持从环境变量获取值
|
* SpringBoot application.properties 支持从环境变量获取值
|
||||||
242
jodconverter-web/pom.xml
Normal file
242
jodconverter-web/pom.xml
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>1.5.8.RELEASE</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>cn.keking</groupId>
|
||||||
|
<artifactId>kkFileView</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<!-- required for org.hyperic:sigar -->
|
||||||
|
<id>jboss-public-repository-group</id>
|
||||||
|
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.logstash.logback</groupId>
|
||||||
|
<artifactId>logstash-logback-encoder</artifactId>
|
||||||
|
<version>4.11</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.keking</groupId>
|
||||||
|
<artifactId>jodconverter-core</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.7</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- REDISSON -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>3.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
|
<version>3.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>fr.opensagres.xdocreport</groupId>
|
||||||
|
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>fr.opensagres.xdocreport</groupId>
|
||||||
|
<artifactId>org.apache.poi.xwpf.converter.xhtml</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>fr.opensagres.xdocreport</groupId>
|
||||||
|
<artifactId>fr.opensagres.xdocreport.document</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 解压(apache) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-compress</artifactId>
|
||||||
|
<version>1.19</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 解压(rar)-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.junrar</groupId>
|
||||||
|
<artifactId>junrar</artifactId>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 解压(7z)-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.tukaani</groupId>
|
||||||
|
<artifactId>xz</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.jchardet</groupId>
|
||||||
|
<artifactId>jchardet</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>antlr</groupId>
|
||||||
|
<artifactId>antlr</artifactId>
|
||||||
|
<version>2.7.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-httpclient</groupId>
|
||||||
|
<artifactId>commons-httpclient</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- FTP -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<artifactId>commons-net</artifactId>
|
||||||
|
<version>3.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.thoughtworks.xstream</groupId>
|
||||||
|
<artifactId>xstream</artifactId>
|
||||||
|
<version>1.4.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>19.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
|
||||||
|
<artifactId>concurrentlinkedhashmap-lru</artifactId>
|
||||||
|
<version>1.4.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.rocksdb</groupId>
|
||||||
|
<artifactId>rocksdbjni</artifactId>
|
||||||
|
<version>5.17.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>pdfbox</artifactId>
|
||||||
|
<version>2.0.15</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>pdfbox-tools</artifactId>
|
||||||
|
<version>2.0.15</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aspose</groupId>
|
||||||
|
<artifactId>aspose-cad</artifactId>
|
||||||
|
<version>19.9</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/lib/aspose-cad-19.9.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/config</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>${build.exclude.resource}</exclude>
|
||||||
|
</excludes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<includeSystemScope>true</includeSystemScope>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
49
jodconverter-web/src/main/assembly/assembly.xml
Normal file
49
jodconverter-web/src/main/assembly/assembly.xml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<assembly
|
||||||
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
<format>tar.gz</format>
|
||||||
|
</formats>
|
||||||
|
<includeBaseDirectory>true</includeBaseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/bin</directory>
|
||||||
|
<outputDirectory>${file.separator}bin</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>*.sh</include>
|
||||||
|
</includes>
|
||||||
|
<fileMode>755</fileMode>
|
||||||
|
<lineEnding>unix</lineEnding>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/bin</directory>
|
||||||
|
<outputDirectory>${file.separator}bin</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>*.bat</include>
|
||||||
|
</includes>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/config</directory>
|
||||||
|
<outputDirectory>${file.separator}config</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/log</directory>
|
||||||
|
<outputDirectory>${file.separator}log</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/office</directory>
|
||||||
|
<outputDirectory>${file.separator}office</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.build.directory}</directory>
|
||||||
|
<outputDirectory>${file.separator}bin</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>*.jar</include>
|
||||||
|
</includes>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</assembly>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user