File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Printer trays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Printer trays" Watch "Printer trays" New topic

Printer trays

jack nick
Ranch Hand

Joined: Jan 11, 2001
Posts: 96
Hello there,

I am looking for a Java solution that will enable me to have control over the printer tray to which my application prints. Thanks.

Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Look in the packages javax.print and javax.print.attribute. Perhaps the class javax.print.attribute.standard.MediaTray can help you here. It does not let you specify a tray per se, but rather a tray that contains a particular type of media (e.g. A4 paper).
Ganapathy Kumar

Joined: Jun 17, 2007
Posts: 2
Hi All,

I have the same problem.. i tried selecting a tray from a printer...

using MediaTray .. was not able to do so.. the print was from a

default tray only...

this was the code i used...

PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

PrintService[] pservices = PrintServiceLookup.lookupPrintServices(
flavor, aset);

atlast i load the PDF and prnt the document.... but i was not able to
print it in the defined Media Tray.. it was from default tray..always..

can somebody help me out with this prob....
Ganapathy Kumar

Joined: Jun 17, 2007
Posts: 2
Hi EveryBody,

No body there to help me out with this problem....

still hoping some body could help me
I agree. Here's the link:
subject: Printer trays
It's not a secret anymore!