Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing with JSP

 
Aaron O'Brien
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have a little program that can print the contents of a canvas. Now, I have decided to implement the same idea into a web page. So when the time comes, I was wondering if it is possible to print the page out at the click of a button (using JSP's of course). I know it's not going to be like a canvas so can anyone lead me in the right direction?
Thanks
Aaron O'Brien
 
Nehal Dave
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To print an HTML page without pressing any button can be achived by javascript. The code down in here prints the page after the page is loaded.

Hope this helps u...
CHeers
Nehal. ..
[ August 27, 2002: Message edited by: Nehal Dave ]
[ August 27, 2002: Message edited by: Nehal Dave ]
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer to associate the print function to a "print button". I guess it is easy to implement, too.
 
Nehal Dave
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ruilin
yea he will have to create a button & then on click of button just call window.print() using javascript...
Nehal.
 
Aaron O'Brien
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!
Aaron O'Brien
 
George Larry
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to make it print out in Landscape (as opposed to portrait)?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic