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();
}
上午什麼我做錯了?