views:

91

answers:

1

Hello, I use Windows XP Professional. How can i get model of printer in package javax.print.* ? For examples: HP LaserJet M1319f MFP, HP LaserJet 3050 Series PCL 6, ...

Here is how i get print services

PrintService[] services =
   PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);

Thank you!,

Minhbt.

A: 

On every PrintService object you can call getName() to receive the printers name.

Petar Minchev
You should distinguish name and model. I see that: default printer name and it model are the same. But you can change your printer name easily!Any ideas?
Minhbt
Try this:PrintServiceAttribute attribute=printService[i].getAttribute(PrinterMakeAndModel.class);But the attribute is always null for printers on my machine:(
Petar Minchev
Hello, I have tried it too, but it returns null all the time :( .
Minhbt
A request for enhancement was entered in 2002, but apparently no reaction till now. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4673400
Petar Minchev