0

I'm trying to search the usb printer which is connected with router(Netgear PR2000) in java code , i tried to use SNMP protocol to get the printer's info from router but get no response.

what i want to do is , search the printer then setup the connection via socket and send the data for printing. can someone share some thoughts on this , thanks very much.

Stone
  • 1
  • 1
  • My first thought is that this should be done through OS, not directly from Java code. This may help: https://docs.oracle.com/javase/tutorial/2d/printing/ – Fildor Jan 15 '16 at 09:59

1 Answers1

0
PrintService[] services = PrinterJob.lookupPrintServices();
for (int index = 0;  index < services.length; index++) {
    System.out.println(">>"+services[index].getName());
}

similar questions are:

How to use Java to print on a network printer?

Java application to print on Network printer

Community
  • 1
  • 1
dinesh saini
  • 431
  • 5
  • 8