2015-06-12 18 views
2

我正在运行一个简单的Java应用程序(JDK 1.8)。我的主要目标是访问文档(不同格式),转换为PDF,然后使用PDFClown计算页数。LibreOffice 4.4.3 - 在不同的服务器上使用jodconverter访问文档

我可以通过在我的项目目录(在我的电脑上)介绍文档来实现。问题是当我尝试访问另一台服务器上的文档时。

org.artofsolving.jodconverter.office.OfficeException:无法加载 文件:不支持URL: “类型检测失败”

这里是我的代码:

public static void main(String[] args) throws FileNotFoundException { 
    OfficeManager officeManager = new DefaultOfficeManagerConfiguration().buildOfficeManager(); 
    officeManager.start(); 
    String path = "\\\\serverIP\\documents\\test.doc"; 
    OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); 
    String outFile = path.substring(0, path.lastIndexOf(".")) + ".pdf"; 
    converter.convert(new File(path), new File(outFile)); 
    Document document = new Document(new org.pdfclown.files.File(outFile)); 
    int countPages = document.getNumberOfPages(); 
    System.out.println(countPages); 
    officeManager.stop(); 
} 

上午什么我做错了?

回答

相关问题