Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Creating a new PrintService with IP address of the Printer



Generally a PrintService will be looked up like in the below snippet

PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob printerJob = defaultPrintService.createPrintJob();

But is there a way to create a new PrintService by specifying the ip address of the printer

for eg:

String myPrinter = "10.101.111.11\\Eighth Floor Ricoh Printer";

PrintService myPrntSrvc = create a service with myPrinter

printJob.setPrintService(myPrntSrvc);