doc.docx.pdf
How to convert a MS Word document file such as .docx and .doc to pdf on Linux using command line tools?
如何在Linux上使用命令行工具将MS Word文档文件(例如.docx和.doc)转换为pdf?
Use LibreOffice:
使用LibreOffice:
libreoffice --headless --convert-to pdf
--outdir /path/to/out/dir/ /path/to/doc/docx/file
While this LibreOffice answer works, the –headless option still needs as display, even though it does not use it. In otherwords, this option won’t work on a truely headless server or from a cron or batch job, unless you fire up a dummy X server (eg xvfb). The LibreOffice people don’t seem inclined to “fix” this:
尽管此LibreOffice答案有效,但–headless选项仍需要显示,即使它不使用它。 换句话说,除非您启动虚拟X服务器(例如xvfb),否则该选项在真正的无头服务器或cron或批处理作业中将不起作用。 LibreOffice人员似乎不倾向于“解决”此问题:
https://bugs.documentfoundation.org/show_bug.cgi?id=107151
https://bugs.documentfoundation.org/show_bug.cgi?id=107151
Hi Robert, thanks for the notes!
嗨罗伯特,谢谢你的笔记!
So in a server without a real X, it seems a command like this is needed (not yet tested):
因此,在没有实数X的服务器中,似乎需要这样的命令(尚未测试):
xvfb-run libreoffice --headless --convert-to pdf
--outdir /path/to/out/dir/ /path/to/doc/docx/file
to make it run by cron or in background.
使它由cron或在后台运行。
TextMaker, the word processor included in SoftMaker FreeOffice, has a much better compatibility with Microsoft Word compared to LibreOffice. You should download FreeOffice without charge, open your doc/docx documents faithfully with TextMaker, press the pdf button, and get a perfect pdf file.
与LibreOffice相比,SoftMaker FreeOffice中包含的文字处理器TextMaker与Microsoft Word具有更好的兼容性。 您应该免费下载FreeOffice,使用TextMaker忠实地打开doc / docx文档,按pdf按钮,然后获得一个完美的pdf文件。
freeoffice.com
freeoffice.com
Does FreeOffice provides a command-line method to generate PDF from word .doc or .docx files? That is required to automatically generating many files.
FreeOffice是否提供了从Word .doc或.docx 文件生成PDF的命令行方法? 这是自动生成许多文件所必需的。
翻译自: https://www.systutorials.com/how-to-convert-a-docx-doc-ms-word-file-to-pdf-in-command-line-on-linux/
doc.docx.pdf