tags:

views:

53

answers:

1

I use javax.print.PrintService to look up printer services on local machine. Here is code to get printers:

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

Can i also get port name of printer (USB001, COM, LPT..) in java?

A: 

You just can't do it with pure Java code (i.e., without using JNI (native code)).

Shimi Bandiel
Hello,Please give me a guidance or link for reference. Thank you!Regards,Minhbt
Minhbt
Hey, You can get port name of printer only on a specific os (WINDOWS XP professional) by trying to access private method getPort() of Win32PrintService . It return port name of printer. By the way, how can i retrieve printer model ?
Minhbt