libreoffice的安装(参考https://www.2cto.com/net/201911/818525.html)
使用此镜像源获取(https://mirrors.tuna.tsinghua.edu.cn/libreoffice/libreoffice/stable)
LibreOffice_6.3.4_Linux_x86-64_deb.tar.gz
LibreOffice_6.3.4_Linux_x86-64_deb_langpack_zh-CN.tar.gz
解压后执行如下命令
dpkg -i LibreOffice_6.3.4.2_Linux_x86-64_deb/DEBS/*.deb
dpkg -i LibreOffice_6.3.4.2_Linux_x86-64_deb_langpack_zh-CN/DEBS/*.deb
安装完成后检查服务器的字体是否存在,如果不存在需要把windows下C:\Windows\Fonts该目录下的字体上传到服务器的当前位置
/usr/share/fonts/Fonts/MSYHL.TTC
/usr/share/fonts/Fonts/simsun.ttc
/usr/share/fonts/Fonts/simhei.ttf
/usr/share/fonts/Fonts/MSYHBD.TTC
/usr/share/fonts/Fonts/MSYH.TTC
/usr/share/fonts/Fonts/SIMKAI.TTF
/usr/share/fonts/Fonts/SIMFANG.TTF
msyh.ttf(微软雅黑 常规)
msyhbd.ttf(微软雅黑 粗体)
simsun.ttc(宋体 常规)
simkai.ttf(楷体 常规)
simhei.ttf(黑体 常规)
simfang.ttf(仿宋 常规)
或者 这个位置(参考https://blog.csdn.net/qq_30554229/article/details/80093894)
/usr/lib/rabbitmq/.config/libreoffice/4/user/fonts
使用如下命令进行pdf转换
libreoffice6.3 --headless --invisible --convert-to pdf /home/files/filetemp/202002181916501578628060393station.docx --outdir /data/logs/
libreoffice6.3 --convert-to pdf:writer_pdf_Export /data/logs/202002181916501578628060393station.docx --outdir /data/logs