81,122
社区成员




File inputFile = new File("F:/hsr.xls");
File outputFile = new File("F:/hsr.pdf");
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
try {
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
System.out.println("!!!!!!!!!!!!!!");
}
catch(Exception e) {
e.printStackTrace();
}
finally {
// close the connection
try{
if(connection != null){
connection.disconnect(); connection = null;
}
}
catch(Exception e){}
}
try {
//开始
String cmd = "cmd /c pdf2swf f:\\hsr.pdf -o f:\\hsr.swf -T 9";
Process process = Runtime.getRuntime().exec(cmd);
int exitCode = process.waitFor();
if (exitCode == 0) {
process.destroy();
}
}
catch (Exception e) {
System.out.println(e.getStackTrace());
}