0

I have three printer queues going to the same printer:

a, No settings standard (colour) b, Black and white c, Black and white + Stapled

setup in Windows. When printing to any of a, b or c the results are always the same and that is that no settings set on the queue are used. Jobs sent to queue c comes out in colour and with no staple. Printing via the windows print dialog the results are as expected, stapled and bw. Codesnippet:

        printServiceAttributeSet.add(new PrinterName("c", null));
        PrintService[] service = null;
        try{
            service = PrintServiceLookup.lookupPrintServices(null, printServiceAttributeSet);
        }catch(Exception e){
            e.printStackTrace();
        }
        DocPrintJob job = service[0].createPrintJob();
        PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
        pras.add(new Copies(1));
        job.print(doc, pras);

Found this old question with the same problem but no Java solution.

Whats going wrong in this scenario? I see the documents going via the printer queues a,b,c but they all end up with with no settings as compared to via the standard printing dialog when using the queues.

1 Answers1

0

For stapling your pages you need to set corresponding PrintRequestAttribute

pras.add(Finishings.STAPLE);

For printing your pages in black & white you need to set corresponding PrintRequestAttribute

pras.add(Chromaticity.MONOCHROME)

Hope this helps

Sanjeev
  • 9,876
  • 2
  • 22
  • 33
  • Yeah I did see those options but I find it very weird that the Java VM isn't honoring the settings already set on the individual printer queues. That's really what I need. For those options to be used. It would make the application much more maintainable for the end user if that's possible. Why else be able to setup queues this way. Thanks for the quick input! – pokemonnogo Aug 03 '16 at 11:21
  • So I went with you answer to see if I actually could get it working on the printer but with the same result. I added both Finishings.STAPLE and Chromaticity.MONOCHROME. No exceptions or anything and still colour documents... Weird... – pokemonnogo Aug 03 '16 at 13:36