Issue

The sendToPrinter component supports the following protocols:

  • CUPS
  • DirectIP
  • LPD
  • SharedPrinter
  • CIFS

In case of SharedPrinter, the Server URI is not used and only the Printer Name is used. The value for the Printer Name can be difficult to find, however, as it can differ from the UNC. 

Solution

The following code can be used in a executeScript operation to list the Shared Printers available from the server:

import javax.print.*;

PrintServiceLookup.lookupPrintServices(null, null);

Start-----");

for(PrintService svc:svcs){

if(svc!=null){

"+svc.getName());

}

}

System.out.println("PrintServices Log

End-----");

 

This results in the following output in your server log file:

[06/05/16

13:17:15:746 BST] 0000026d SystemOut O PrintServices Log Start-----

[06/05/16
13:17:15:762 BST] 0000026d SystemOut O PrintSvc : ZDesigner S4M-300dpi ZPL

[06/05/16
13:17:15:762 BST] 0000026d SystemOut O PrintSvc : server

[06/05/16
13:17:15:762 BST] 0000026d SystemOut O PrintSvc : Send To OneNote 2013

[06/05/16
13:17:15:762 BST] 0000026d SystemOut O PrintSvc : Microsoft XPS Document Writer

[06/05/16
13:17:15:763 BST] 0000026d SystemOut O PrintSvc : LPT1

[06/05/16
13:17:15:763 BST] 0000026d SystemOut O PrintSvc : Fax

[06/05/16
13:17:15:763 BST] 0000026d SystemOut O PrintSvc : Epson ESC/P-R

[06/05/16
13:17:15:763 BST] 0000026d SystemOut O PrintSvc : Adobe PDF

[06/05/16

13:17:15:763 BST] 0000026d SystemOut O PrintSvc : \\EDINBURGH-PRINT\Canon EDI-COE

[06/05/16

13:17:15:763 BST] 0000026d SystemOut O PrintServices Log End-----

You can use this output to configure your sendToPrinter operation:

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy