LibreOffice通过命令方式转pdf

环境:需要装libreOffice软件

package com.demo.libreOffice;
import java.io.IOException;

public class CommandExecute {

	public static void main(String[] args) {  
		try {  
			String cmd = "cmd /k start soffice --convert-to pdf E:/dianziqianzhang/shujuchuxu.docx --outdir E:/dianziqianzhang";  
			Runtime runtime = Runtime.getRuntime();
			Process p = runtime.exec(cmd); 
			
			//关闭进程
			/*if(p != null){
				p.destroy();
			}*/
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}



猜你喜欢

转载自blog.csdn.net/xqhys/article/details/79875203
今日推荐