http://www.javaeye.com/topic/352103

 

* 完成word2pdf的转换
     */
    public void GeneratePdfFromWord() {
        Date date = new Date();
        
        OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
        
        try {
            connection.connect();    
             DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
                converter.convert(new File("d:\\test.doc"), new File("d:\\word2pdf.pdf"));
                
        } catch (Exception e) {
            // TODO: handle exception
        } finally {
            if(connection!=null){
                connection.disconnect();
                connection = null;
            }

        }
    }