title: How can I print multiple pages to different trays within one print job using Java?
body: <p>when printing with Java, one can select the media tray (within PrintRequestAttributeSet). Then one can pass this setting to a printjob and have one's document printed to the given tray.</p>
  
  <p>My question is now: can I somehow specify that the first page is printed to one tray and the second one to another tray <strong>within one print job</strong>?</p>
  
  <p>I'm reluctant to creating two separate print jobs, because my usage scenario is a mass-print, of say 1000 documents. Each document has some pages going to tray 1 and some pages going to tray 2. 
  If I have to create a new print job on each switch of trays, I would end up with several thousands of separate print jobs and I'm afraid of all sorts of print-spooler overruns and system crashes. Thus my preference to somehow sneak those "switches of tray" into one print job.</p>
  
  <p>I'm pretty sure that it can be sone somehow, but didn't succeed so far.</p>
  
  <p>I thought about creating those thousands of PrinterJobs, but having them print to a <em>StreamPrintService</em> (instead of an actual print service), thus capturing the switches of tray along with the actual printing data. Then I was planning to concatenate the results of those single "virtual" prints and send it all to a real printer in one <em>real</em> print job.</p>
  
  <p>However, with java 1.6 there seems to be only one StreamPrintService, which can only output postscript. 
  So: is there a way to capture the raw, <em>native</em> output from a native printer driver (using java)? Does it seem practical to you to concatenate that output and send it to the printer, in order to solve my problem? </p>
  
  <p>I would be glad, also about comments regarding only parts of the problem..</p>