下载地址:http://www.openoffice.org/zh-cn/download/
安装
wget https://jaist.dl.sourceforge.net/project/openofficeorg.mirror/4.1.6/binaries/zh-CN/Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz
tar -zxvf Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz
cd zh-CN
cd RPMS
yum -y localinstall *.rpm
cd desktop-integration
yum -y localinstall openoffice4.1.6-redhat-menus-4.1.6-9790.noarch.rpm
启动
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
检查
ps -ef|grep openoffice
netstat -lnp |grep 8100
初始化kkFileView项目
git clone https://github.com/kekingcn/file-online-preview.git
vi jodconverter-web/src/main/resources/application-dev.properties
spring.redisson.address = 127.0.0.1:6379
file.dir = /data/preview/
office.home = /opt/openoffice4
安装maven
wget http://ftp.cuhk.edu.hk/pub/packages/apache.org/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip
unzip apache-maven-3.6.0-bin.zip
mv apache-maven-3.6.0 apache-maven
vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64
export MAVEN_HOME=/usr/local/apache-maven
export PATH=$PATH:$MAVEN_HOME/bin
获取(安装)项目依赖包 ps:注意此时不要把openoffice的服务开启
mvn clean install
打包
mvn package
开启web服务
java -jar jodconverter-web-1.5.8.RELEASE.jar cn.keking.FilePreviewApplication &
访问
http://localhost:8012
解决中文乱码:
yum groupinstall chinese-support
fc-cache
然后重启openoffice服务和kkfileview服务
参考文章:https://blog.csdn.net/xyh930929/article/details/80973255