I am looking for option where I can send the file to network printer using JAVA running on weblogic/Linux OS.
I searched throughly on web but not able to find a proper solution.
So, I am able to send the file to printer IP using Socket, but in this case I am not able to set Page Size or Number of copies. Thus when printer receive file, it beeps and then user has to manually select page size at printer.
Socket sock = new Socket("190.129.2.4", 9100);
OutputStream output=sock.getOutputStream();
InputStream reader = new FileInputStream("./STEST.pdf");
byte[] bytes = IOUtils.toByteArray(reader);
output.write(bytes);
sock.close();
} catch(Exception e){
e.printStackTrace();
}
I tested Java printer API, but the Java API lookupservices require printer to be added on the machine, as it is the server machine I cannot add the printers to it (Admin restrictions). I tested printer API on windows by adding the printer and it works, but i do not know how do I send files if the printer is not added.
I also have the network printer Q path "\\HOSTNAME\RICOHAMP4002”
I need a solution, where I can send the files for printing to the network printer without adding the printer on the server machine.
Help really appreciated as it is getting escalated on my end and need some working approach soon.