• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

take print out of jsp page without default header

 
simran chandwani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 = window.open('','','left=0,top=0,width=500,height=500,top=301,left=365,resizable=1,status=0,toolbar=0');
Win4Print.document.write(printContent.innerHTML);
Win4Print.document.close();
Win4Print.focus();
Win4Print.print();
Win4Print.close();
}

Regards,
Y. Keerthi Sagar.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Eric
 
jyoti sarangi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.......???///

regards,
JytoiShankar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic