这是我从ghost4j官方网站复制的代码:
BasicConfigurator.configure();
Ghostscript gs = Ghostscript.getInstance();
String[] gsArgs = new String[7];
gsArgs[0] = "-dQUIET";
gsArgs[1] = "-dNOPAUSE";
gsArgs[2] = "-dBATCH";
gsArgs[3] = "-dSAFER";
gsArgs[4] = "-sDEVICE=display";
gsArgs[5] = "-sDisplayHandle=0";
gsArgs[6] = "-dDisplayFormat=16#804";
try {
gs.initialize(gsArgs);
gs.runFile("input.ps");
gs.exit();
} catch (GhostscriptException e) {
System.out.println("ERROR: " + e.getMessage());
}
}}
链接到官方网站: 在此处输入链接描述