camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmh <jeanmarc.her...@nrb.be>
Subject Re: print a PDF with camel-printer
Date Wed, 19 Sep 2012 22:09:30 GMT
thanks Babak

But I have another problem on Windows 2008 server.

services (printers) are prefixed by "Win32 Printer :" 

i.e :[Win32 Printer : Microsoft XPS Document Writer, Win32 Printer :
\\nrbnrw0264\nrbco006]

But when I look the source code, I realize that it can never be equal to the
config :-(


<pre>
      PrintService printService;
085            
086            if ((config.getHostname().equalsIgnoreCase("localhost")) 
087                &&
(config.getPrintername().equalsIgnoreCase("/default"))) {
088                printService =
PrintServiceLookup.lookupDefaultPrintService();            
089            } else {
090                PrintService[] services =
PrintServiceLookup.lookupPrintServices(null, null);
091                setPrinter("\\\\" + config.getHostname() + "\\" +
config.getPrintername());
092                int position = findPrinter(services, printer);
093                if (position < 0) {
094                    throw new PrintException("No printer found with name:
" + printer + ". Please verify that the host and printer are registered and
reachable from this machine.");
095                }         
096                printService = services[position];
097            }
098            return printService;
099        }
100        
101        private int findPrinter(PrintService[] services, String printer)
{
102            int position = -1;
103            for (int i = 0; i < services.length; i++) {
104                if (printer.equalsIgnoreCase(services[i].getName())) {
105                    position = i;
106                    break;
107                }
108            }
109            return position;
110        }
</pre>

J-M



--
View this message in context: http://camel.465427.n5.nabble.com/print-a-PDF-with-camel-printer-tp5719615p5719631.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message