pdf转换为swf,cannot open pdf文件
在window7上部署的项目,可以正常由pdf转换为swf,但在linux上部署的项目,却报以下错误:
cannot open pdf文件,代码: // 先生成flash
String[] envp = new String[1];
envp[0] = "PATH=/app/bin/";
String command = "pdf2swf -z -s flashversion=9 \"" + sourcePath+ "\" -o \"" + destPath + fileName + "\"";
System.out.println("pdf command--------------------------------------------------------"+envp[0]+"=="+command);
System.out.println(command);
int exitValue =0;
Process pro = Runtime.getRuntime().exec(command);
try{
pro = Runtime.getRuntime().exec(command);
InputStreamReader ir=new
InputStreamReader(pro.getInputStream());
BufferedReader input = new BufferedReader (ir);
String line;
while ((line = input.readLine ()) != null){
System.out.println(line);
}//end try
exitValue = pro.exitValue();
} catch (java.io.IOException e){
System.err.println ("IOException " + e.getMessage());
}
linux 上的java程序拼出来的系统命令中去掉双引号,即:
把String command = "pdf2swf -z -s flashversion=9 \"" + sourcePath+ "\" -o \"" + destPath + fileName + "\"";
改成如下一句
String command = "pdf2swf -z -s flashversion=9 " + sourcePath+ " -o " + destPath + fileName;