import com.google.common.io.Files;//进行文件写入操作
public static boolean transform(String svgValue,String svgPath,String pdfPath){ //
String command = GojaConfig.getProperty("exportCommand"); // 通过配置文件获取命令行字符串
final File svgFile = new File(svgPath);
final File pdfFile = new File(pdfPath);
command = String.format(command, svgFile, pdfFile); // 根剧参数格式化字符串 command = “---- %s --- %s”
try {
Files.write(svgValue, svgFile, Charsets.UTF_8);
Process pro = Runtime.getRuntime().exec(command); // 调用命令行执行command命令
pro.waitFor(); // 等待执行结束
} catch (IOException e) {
return false;
} catch (InterruptedException e) {
return false;
}
return true;
}