首页  »   PowerDesigner

openoffice回实现将word转换成pdf

网友分享于:2014-01-08  浏览:118次
openoffice来实现将word转换成pdf

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;
            }

        }
    }

相关解决方案

最新解决方案