windows 从命令行将 DOC 转换为 PDF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7560244/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:10:05  来源:igfitidea点击:

Convert DOC to PDF from Command Line

windowspdfcommand-linedocxdoc

提问by user489041

Anyone recommend a DOC to PDF converter that can be run from the command line? It seems like an easy requirement, but I have been coming up short on free solutions.

有人推荐可以从命令行运行的 DOC 到 PDF 转换器吗?这似乎是一个简单的要求,但我一直缺乏免费的解决方案。

回答by Ptofanelli

I recommend the OfficeToPDFcommand line application.

我推荐OfficeToPDF命令行应用程序。

C:\>OfficeToPDF.exe /bookmarks /print /verbose test.docx test.pdf
Converting test.docx to test.pdf
Converting with Word converter
Completed Conversion
C:\>

I used this solution to automate the PDF generating using ANT.

我使用此解决方案使用 ANT 自动生成 PDF。

回答by Barry Kaye

I appreciate you are trying to do this from the command line but because you mentioned C#, the approach I use to is to first convert a doc to ps (PostScript) in C# which is relatively simple and well documented and then from the command line use Ghostscriptto convert to PDF. Pls don't underestimate the tool from the basic looking website - it is amazing.

感谢您尝试从命令行执行此操作,但是因为您提到了 C#,我使用的方法是首先将 doc 转换为 C# 中的 ps(PostScript),这相对简单且文档齐全,然后从命令行使用Ghostscript转换为 PDF。请不要低估基本外观网站上的工具 - 它很棒。