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