Tutorial :Printing from a batch Java job


Have done some research into this topic, but found no relevant answers. What I need is to print a number of PDF files on one of three forms, which are loaded into different trays of a particular printer. I need to specify which printer to use and it's not the default printer. Additionally, I need to specify which tray to use based upon an attribute of each PDF file and be able to switch between them at run time. Java PrintService seems to only be interested in the local default printer. I'd appreciate any suggestions on how to accomplish this task. Thanks.


The Printer API does allow for talking to different printers other than the default. That being said it is limited. What we did in our shop is to write a JNI layer that talks directly to the Print Queue of Windows and we use that. If you want finer control than the PrintService API provides you will need to write a JNI layer and access that from Java.


You could configure a different printer for each tray in your OS, Then print to that printer depending on the properties of your file.


Thanks for all the suggestions, but I think I have worked this out now. I'm using LPR for the printing and org.apache.commons.net.ftp.FTPClient for the tray switching commands. The actual tray commands are in text files. My tests (so far) have been successful and I did not have to install the printer on my workstation.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »