关于word文件转换为pdf文件

1、centos下安装libreoffice

sudo yum install libreoffice

2、命令行执行word转pdf

将 /mnt/hgfs/test.docx目录下的test.docx转成pdf存放到 /mnt/hgfs 目录下:

libreoffice --headless --convert-to pdf:writer_pdf_Export /mnt/hgfs/test.docx --outdir /mnt/hgfs

3、如果出现以下错误

 /usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
 (See "man X" resp. "man xhost" for details)

-- 执行 sudo  yum install libreoffice-headless即可 

参考:

1、https://www.jb51.net/article/127358.htm

2、https://blog.csdn.net/pwtitle/article/details/51684685

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。