首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu使用JODconverter和openoffice将文档转换为pdf

Ubuntu使用JODconverter和openoffice将文档转换为pdf
EN

Stack Overflow用户
提问于 2014-04-18 15:03:55
回答 1查看 743关注 0票数 0

我已经安装了java和openoffice,但我收到以下错误消息:

代码语言:javascript
复制
root@ubuntu:/var/www/html# java -jar JODConverter/jodconverter-3.0-beta-1.jar test.doc test.pdf
Exception in thread "main" java.lang.IllegalArgumentException: officeHome doesn't exist: /opt/openoffice.org3
at net.sf.jodconverter.office.ManagedOfficeProcess.<init>(ManagedOfficeProcess.java:58)
at net.sf.jodconverter.office.ManagedProcessOfficeManager.<init>(ManagedProcessOfficeManager.java:89)
at net.sf.jodconverter.office.ManagedProcessOfficeManager.<init>(ManagedProcessOfficeManager.java:85)
at net.sf.jodconverter.cli.Convert.getOfficeManager(Convert.java:120)
at net.sf.jodconverter.cli.Convert.main(Convert.java:97)
EN

回答 1

Stack Overflow用户

发布于 2014-04-22 13:19:45

您可以像这样设置officeHome (第二个setter):

代码语言:javascript
复制
// create the officemanager with the given settings
officeManager = new DefaultOfficeManagerConfiguration()
    // either socket or pipe, pipe is faster but requires native libraries
    .setConnectionProtocol(OfficeConnectionProtocol.SOCKET)
    // the installation directory of the openoffice installation
    .setOfficeHome(new File(officeHome))
    // the amount of ports in the array determines how many instances are managed
    .setPortNumbers(portNumbers)
    // after how many tasks the process is restarted as a work around to the known memory leaks in openoffice
    .setMaxTasksPerProcess(maxTasksPerProcess)
    // how long a task can run before it is considered timed out, default is 2 min
    .setTaskExecutionTimeout(taskExecutionTimeout)
    // how long the code waits for a process to become available, default is 30 seconds
    .setTaskQueueTimeout(taskQueueTimeout)
    .buildOfficeManager();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23149115

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档