I´m running a simple Java Application (JDK 1.8). My main goal is to access a document (different formats), convert to PDF and then count the number of pages using PDFClown.
I can do it by introducing Documents on directory of my project (on my computer). The problem is when I try to access documents on another server.
org.artofsolving.jodconverter.office.OfficeException: could not load document: Unsupported URL : "type detection failed"
Here is my code:
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();
}
What am I doing wrong?