This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

A50,100,0,3,2,2,N,"PART : "
A50,200,0,3,2,2,N,"SUB : "
A50,300,0,3,2,2,N,"RMA : "
Author and ninkuma
Posts: 66425
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

One 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.
[ May 16, 2004: Message edited by: Bear Bibeault ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!