2

Apache Open Office service running on port 8100 Input file is .docx

OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); 
        DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
        converter.convert(inputFile, outputFile);
        connection.disconnect();

Getting Exception

Exception in thread "main" java.lang.IllegalArgumentException: unknown document format for file: D:\vctest\EDItestingprocess.docx at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.guessDocumentFormat(AbstractOpenOfficeDocumentConverter.java:121) at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:93) at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:74) at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:70) at com.redrock.util.ExcelToPdf.main(ExcelToPdf.java:18)

Nageshwar
  • 55
  • 1
  • 13

1 Answers1

0

1st start openoffice using cmd.

If you already have a servlet container/application server you can download the jodconverter-webapp-x.y.z.zip distribution that contains a war archive ready for deployment.

For example with Tomcat 4.1 or 5.5 all you have to do is

optionally rename jodconverter-webapp-x.y.z.war to something more user-friendly since the name will be visible in the URL, e.g. converter.war copy it into the webapps folder inside the Tomcat installation it will be automatically deployed and visible at (tipically) http://localhost:8080/converter/ if required, configure your firewall or servlet container to restrict access to the webapp.

Sangram Badi
  • 4,054
  • 9
  • 45
  • 78
  • There is no direct support to convert .docx to pdf by using Apache Open office with JODConverter. After googling i found above code for converting docx to doc & xlsx to xls and then next step i am using jodconverter for pdf conversion. – Nageshwar Sep 06 '16 at 13:45
  • can please tell we which open source API will good for converting docx to pdf, doc to pdf and etc. because i had used lots of api but i could not able to get correct output with proper format – Sangram Badi Sep 06 '16 at 14:36