I have a printer with different paper trays, and some trays have different paper sizes.
For example I have Tray 3, with paper size DIN/ISO A5 (5.83" x 8.27")
I want to write a program which automatically (not having shown a printer dialog) prints a document (using JasperReports) on that tray. This tray I can select with putting a Win32MediaTray class object to the PrintRequestAttributeSet as described in the following solution:
The problem is that this document is sent with DIN/ISO A4 to the printer and the printer either shows an error or the print out is on the wrong position on the paper.
How do I also set the paper size for the print out? When I put the MediaSizeName.ISO_A5 Object to the PrintAttributeSet, the paper size is set correctly, but then not the correct tray is used any more. So it seems that putting a MediaSizeName-Object to the PrintAttributeSet overwrites the Win32MediaTray-Attribute set.
How is it possible to set both printer tray and paper size?
is it possible to select the paper tray and the paper size for printing in Java.