• 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

take print out of jsp page without default header

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic