问题
I have to print a PDF file in java program and make sure it's printed successfully, else throw exception.
My Code is:
Process p = Runtime.getRuntime().exec("lp -c -n 1 -d 1.2.3.4 abc.pdf");
System.out.println(p.waitFor());
Above code prints 0, but it only confirms that job is submitted fine, how to make sure that it's printed also.
Is there any other way to do this?
回答1:
Run lpstat (after lp) and capture the process output.
来源:https://stackoverflow.com/questions/14616733/runtime-exec-lp-command-print-success