1

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.

minhb
  • 11
  • 3

1 Answers1

0

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

Petar Minchev
  • 46,889
  • 11
  • 103
  • 119
  • 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? – minhb Jan 26 '10 at 06:47
  • Try this: PrintServiceAttribute attribute=printService[i].getAttribute(PrinterMakeAndModel.class); But the attribute is always null for printers on my machine:( – Petar Minchev Jan 26 '10 at 07:03
  • Hello, I have tried it too, but it returns null all the time :( . – minhb Jan 26 '10 at 08:46
  • 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 Jan 26 '10 at 09:07