0

我是openoffice的新手。我想将文件传输到 pdf 文件。我第一次跑得很好。然后每次我运行它时,都会出现错误消息。

public class Doc2Swf {
private static OfficeManager officeManager;
private static String OFFICE_HOME = "C:\\Program Files\\OpenOffice 4";


protected static void startService(){
    DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
    configuration.setOfficeHome(OFFICE_HOME);
    configuration.setPortNumber(8100);
    configuration.setTaskExecutionTimeout(1000*10);
    configuration.setTaskQueueTimeout(1000*60*60*24L);
    officeManager = configuration.buildOfficeManager();
    try {
        officeManager.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

public static void convert(String srcPath,String outputPath){
    OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
    try {
        converter.convert(new File(srcPath), new File(outputPath));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

protected static void stopService(){
    officeManager.stop();
}

public static void main(String[] args) {
    startService();
    convert("D:\\Android.docx", "1.pdf");
    stopService();
}

}

org.artofsolving.jodconverter.office.OfficeException:任务未在超时内完成

该文件不是一个大文件。它的大小小于 5MB。所以我想知道当我将它设置为 10 秒时它怎么会超时。

4

0 回答 0