File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes take print out of jsp page without default header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "take print out of jsp page without default header" Watch "take print out of jsp page without default header" New topic

take print out of jsp page without default header

simran chandwani

Joined: Jun 29, 2009
Posts: 2
I need to take print out of jsp page. I am using window.print() of javascript. It prints page with default header & footer . I need take print outs without header & footer . Can anybody suggest me.

Thanks in adv

Simran Chandwani
Keerthi Sagar

Joined: Apr 21, 2007
Posts: 28
Hi Simran,
Check the following steps;
=> Write the whole content in a div tag
=> Open a popup window write the contents into that window
=> Print the popup window
=> Close the popup window.

Sample javascript function will be like;
function CallPrint(){
var printContent = document.getElementById("txtDiv");
var Win4Print ='','','left=0,top=0,width=500,height=500,top=301,left=365,resizable=1,status=0,toolbar=0');

Y. Keerthi Sagar.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Default Header and Footer = the date, timestamp, url, title?

The answer is, not possible without hacking your user's computer

If it is your header and footer, CSS Print Media is your answer, no need for pop up windows.

jyoti sarangi

Joined: Nov 03, 2009
Posts: 1
i have little bit different situation ... i need all the pages to contain header and footer...... for some record if am taking the print out then its coming in one page if data is small....but in some cases my jsp is going for 4 pagees....... in that situation header is coming in the first page and footer is coming in the last page........can it possible to do something which will set the header and footer for all the pages.......???///

I agree. Here's the link:
subject: take print out of jsp page without default header
It's not a secret anymore!