Hello,
My Destop application use javax.print.* to detech printer. However, what i get are all the printers that are in Control Panel/Printers and Faxes folder. How can i distinguish hardware printers( real printer) and software printers(got from installing software:Snagit 9, ... ) to remove software printers from printer lists?
My code:
services =
PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
// check for a default service and make sure it is at index 0. the lookupPrintServices does not
// aways put the default printer first in the array.
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
if (defaultService != null && services.length > 1) {
PrintService printService;
for (int i = 1, max = services.length; i < max; i++) {
printService = services;
if (printService.equals(defaultService)) {
// found the default printer, now swap it with the first index.
PrintService tmp = services[0];
services[0] = defaultService;
services[i] = tmp;
break;
}
}
}
Can i select correct printers from function: PrintServiceLookup.lookupPrintServices with correct conditions?
Thank you.
Minhbt.
Edited by: minhbt on Jan 7, 2010 7:03 PM