【发布时间】:2013-08-16 02:37:30
【问题描述】:
我正在使用以下代码使用 JOD 将 .doc 转换为 .pdf。
File inputFile = new File("document.doc");
File outputFile = new File("document.pdf");
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
// close the connection
connection.disconnect();
但我必须跑
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
单独以无头模式启动 LibreOffice。
有没有办法以编程方式启动 LibreOffice?或者,我们不能将 LibreOffice 文件夹的路径提供给 JOD 进行转换吗?
【问题讨论】:
-
JODconverter 3.0 似乎可以在需要时启动 LibreOffice,请参阅code.google.com/p/jodconverter/wiki/GettingStarted。
标签: openoffice.org libreoffice jodconverter