1

I am using pdfbox(pdfbox-app-2.0.0-RC3.jar) to convert any file to .pdf file. I am also using jodconverter-2.2.1.jar library.

Code I wrote (following this):

import com.artofsolving.jodconverter.openoffice.connection.*;
import com.artofsolving.jodconverter.openoffice.converter.*;
import com.artofsolving.jodconverter.*;
import java.io.File;
public class PdfBox {
public static void main(String[] args) throws Exception{
    
    try {
        OpenOfficeConnection con=new SocketOpenOfficeConnection(8100);
        con.connect();
        File inputFile=new File("x.docx");
        File outputFile=new File("x.pdf");
        DocumentConverter converter=new OpenOfficeDocumentConverter(con);
        converter.convert(inputFile,outputFile);
        con.disconnect();
    } catch (Exception e) {
        System.out.println(e);
    }
} 
}

Error message I get: enter image description here

Any idea to get rid of this will be appreciated.

Community
  • 1
  • 1
partho
  • 1,101
  • 2
  • 21
  • 37

1 Answers1

2

You need to add openoffice-ridl-2.0.3.jar (or some version of openoffice's jar) to your classpath.

Kylar
  • 8,876
  • 8
  • 41
  • 75
  • I am unable to find that .jar download link searching google. help me please? – partho Feb 24 '16 at 19:06
  • How I can download http://www.java2s.com/Code/Jar/o/Downloadopenofficeridl203jar.htm this file? – partho Feb 24 '16 at 19:10
  • You should be using some kind of dependency resolution mechanism like Maven. The maven repository has all the jars you'll need - but there's a lot more you'll need to include just to use jodconverter: http://mvnrepository.com/artifact/com.artofsolving/jodconverter/2.2.1 – Kylar Feb 24 '16 at 19:31