0

Hello there, Im newbie in JSP..

I has a critical situation here, and I want to ask, how to access client printer in jsp? below is my current code:

fIn = new File(BCODE_DIR, BCODE_FNAME_RSCH + BCODE_FEXT); // access existing barcode template
fOut = new File(BCODE_DIR, BCODE_FNAME_RSCH + i + BCODE_FEXT); // create new template
				
copyfile(fIn, fOut); // write new template in existing template
patch(fOut); // Write back to file

Process p = Runtime.getRuntime().exec("cmd /c copy " + fOut.getAbsolutePath() + " lpt1"); // send print command to printer
				
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));

before this, the code send print command to printer is working because this system run in local, also the printer is attach to the PC but now, when I move the system to server, and the printer is on client side, the command is not working.

Anyone can help me to fix this issue ??

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by masijade
0

In short, you can't. JSP's and Servlets run on the server and the clients (if they are at all interested in safety/security won't give those resources free to the world). Produce a "print" page for the browser and let the client push "print".

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.