IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes Can raw data be sent  to a client printer from a JSP?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Can raw data be sent  to a client printer from a JSP??" Watch "Can raw data be sent  to a client printer from a JSP??" New topic
Author

Can raw data be sent to a client printer from a JSP??

Dave Brooks
Greenhorn

Joined: May 16, 2004
Posts: 3
I have serached high and low for a way to do this. I hope someone can help. Project dealine is here!!! I have a barcode printer that I need to send raw data to from my JSP. The file contains instructions for the printer on how to print the document. Using window.print() formats the file as text and I simply get what displays in the web browser. Security is not really an issue as the application is only going to be used over company intranet. Any help anyone could provide would be greatly appreciated. Thanks in advance.

Below is the type of data I need to send to the client printer


N
A300,100,0,3,2,2,R,"123-45467890"
A50,100,0,3,2,2,N,"PART : "
A300,200,0,3,2,2,R,"DEF"
A50,200,0,3,2,2,N,"SUB : "
A300,300,0,3,2,2,R,"9876543210"
A50,300,0,3,2,2,N,"RMA : "
B50,400,0,1,4,6,100,B,"9876543210"
P1
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

JSP technology will be of no help to you. As you know, JSP executes on the server to format the HTML/Javascript page that is sent to the client. Once sent to the browser, all "JSP-ness" is gone. So if you can't do it with HTML/Javascript, you can't do it with JSP.

Problem is, window.print() will, as you have seen, print the page as renderred.

Once possibilitiy, which I am not sure will work or not, is to load up the "raw data" in an invisible iframe embedded on the page, and use window.print on it from the parent.

If this does not work, perhaps an Applet approach might work, but I do not know if Applets have access to the print system of the client.

In any case, this isn't a JSP issue so I'm going to move this along to the HTML/Javascript forum for further investigation.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
 
subject: Can raw data be sent to a client printer from a JSP??
 
Threads others viewed
Print RAW BYTES to thermal printer
Can raw data be sent to a client printer from a JSP??
Printing API Question
Help with HTTP I/O
JSP Printing
developer file tools