• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing from JSP

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I would like to print the data from a jsp-page, to a desired printer! I'm not sure how to do this, and the normal javascript print() is not OK. I would like to set the size for the object.
I was thinking about to use the java printing API via a JavaBean, but I'm not sure how it will work.
Is it going to do all the work on the server and the user will not se anything?
Can someone lead me in the right direction? Am I totally lost, thinking like this?
/Emil Karlsson
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't use the java printing API in a JSP (possibly in a trusted applet, but not a JSP.) because the printing API must be run on the same machine as the print job will be sent from.
You will need to use javascript to print. I'm not sure if javascript print() can be customized. You will probably have more luck in the HTML/Javascript forum.
(edited because I didn't know colon - p is a smiley)
[ September 11, 2003: Message edited by: Jeanne Boyarsky ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed. Moving to HTML/Javascript.
bear
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
You can't use the java printing API in a JSP (possibly in a trusted applet, but not a JSP.) because the printing API must be run on the same machine as the print job will be sent from.


unless you want to print on the server of course (but that might be prevented by security on the application server level).
Javascript is indeed the way to go.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaScript can not point you to a certain printer, but you can tell people to change the printer location with an alert.
function Eat(){
alert('blah');
window.print();
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic