Dre*_*ejc 15 nant build-automation build-process openoffice.org libreoffice
我有一些用OpenOffice编写的文档,我想在最终的构建交付中包含一些PDF文件.我想用自动构建脚本来做这件事.
有没有办法使用命令行命令从OpenOffice创建PDF文件?
Ein*_*eki 28
截至2012年9月,LibreOffice可以从命令行将文档转换为PDF:
lowriter --headless --convert-to pdf yourfile.odt
Run Code Online (Sandbox Code Playgroud)
它还具有批量转换支持:
lowriter --headless --convert-to pdf yourfiles*.odt
Run Code Online (Sandbox Code Playgroud)
将所有匹配模式的文件转换为相应的PDF文件.
运行此命令时,必须没有打开LibreOffice窗口.
Osc*_*Ryz 12
Art of Solving也有一个很好的API来执行Java中的转换.它有点慢,但很简单.这就是我使用它的方式:
File inputFile = new File("C:\\oreyes\\hola.doc");
File outputFile = new File("C:\\oreyes\\hola.pdf");
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
try {
connection.connect();
} catch(Exception e) {}
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
connection.disconnect();
Run Code Online (Sandbox Code Playgroud)
您可以使用它创建一个jar并从命令行处理它.
| 归档时间: |
|
| 查看次数: |
28880 次 |
| 最近记录: |