调用PDF的打印命令,但是这种情况下是调用得服务器端的打印机环境,也就特定环境下能用。
FileOutputStream fosw = new FileOutputStream(new File("c:/a.pdf"));
byteStream.writeTo(fosw);
byteStream.close();
fosw.close();
try{
String osName = System.getProperty("os.name" );
// FOR WINDOWS 95 AND 98 USE COMMAND.COM
if(osName.equals("Windows 95") || osName.equals("Windows 98")){
Runtime.getRuntime().exec(
"command.com /C start AcroRd32 /p /h \"C:/Documents and Settings/duanqingfeng/My Documents/cpcc_result_1.pdf\"");
}
// FOR WINDOWS NT/XP/2000 USE CMD.EXE
else {
Runtime.getRuntime().exec(
"cmd.exe /C start acrord32 /p /h C:/a.pdf");
}
} catch (Exception e) {
e.printStackTrace();
}