Error while converting doc to pdf using jodconverter

1.1k views Asked by At

I am using follwing code to convert doc file to pdf using jodconvert library. it working fine some time only, some time it fire error as described below.

Code :

 try{
   Runtime rt = Runtime.getRuntime();  
   Process pSoffice = rt.exec(OpenOfficeConnString);
   File inputFile = srcDoc;
   String destDoc = srcDoc.getAbsolutePath().substring(0,
                    srcDoc.getAbsolutePath().lastIndexOf("."))
                    + "." + outputFileExt;

   outputFile = new File(destDoc);

   //connect to an OpenOffice.org instance running on port 8100
    OpenOfficeConnection connection = new SocketOpenOfficeConnection(
                    8100);
   connection.connect();
  // convert
   DocumentConverter converter = new OpenOfficeDocumentConverter(
                    connection);
   converter.convert(inputFile, outputFile);
// close the connection
   connection.disconnect();


}catch (Exception e) {
   e.printStackTrace();
}

Error :

java.net.ConnectException: connection failed: socket,host=localhost,port=8100,tcpNoDelay=1: java.net.ConnectException: Connection refused: connect
0

There are 0 answers