• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to know whether a printer is switched off/disconnected

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
The PrintServiceLookup.lookupPrintServices method returns a list of all the installed printers. of all such installed (networked) printers how can one know whether a printer is switched off or disconnected?

my code:

public void lookupPrinter(String printerName) throws ModelException {

PrintService selectedPrintService = null;
PrintService[] services = PrintServiceLookup.lookupPrintService(DocFlavor.SERVICE_FORMATTED.PRINTABLE,null);
if(services.length>0){
int printerIndex=0;
for(int i=0; i<services.length;i++){
if (services[i].getName().equalsIgnoreCase(printerName)) {
selectedPrintService = services[i];
}
}
}


should I use PrinterState for that perpose or printerStateReason ? if so, how?

PrinterState pState = services[0].getAttribute(PrinterState.class); - Doesnt work, I get null all the time

Please advise

thanks a lot..
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think printing is more closely related to GUI issues, so I'm going to move this post to that forum.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic