Prevent headers/footers on page printer

  Awestruck 26 Apr 09
Locked

How can I prevent headers and footers printing when someone clicks the 'Print this page' button on website pages. By headers and footers I mean the website details, page numbers and date.
My button code is:-

!--Start of page printer-->
input type="button" value="Print this page" onclick="window.print()" title="Print this page">
!--End of page printer-->

Regards

Awestruck

  Kemistri 26 Apr 09

Hide them and any other extraneous elements with your print stylesheet.

#id-of-element {display:none;}

  Awestruck 27 Apr 09

Thank you Kemistri for your prompt reply. However, the headers and footers are not part of my web page. They are the headers and footers inserted by IE by default. In IE if you click File-->Page setup you will see

Header &w &b Page &p of P
Footer &u&b&d

These web client commands print the web address, page number, date etc which takes up space on the printed page.

I hoped to temporarily have these turned off when someone prints my page. I think I am asking the impossible.
Awestruck

  Kemistri 27 Apr 09

It would have been helpful if you had described the problem more accurately - your post reads like you are asking about print stylesheets and, of course, most pages have headers and footers.

The print data, however, has nothing to do with a HTML and everything to with browser functionality. It is placed there by the browser. Some browsers allow print data to be customised or removed but we (rightly) have no control over that.

Why even worry about its presence anyway?

  Awestruck 27 Apr 09

Hello Kemistri

I did spell it out but perhaps not clearly enough.

My original post said:-
"By headers and footers I mean the website details, page numbers and date".

None of my website pages have headers or footers.

Why worry? Because I try to get an order form to print out on one page rather than say a page and a quarter. To get the order form on one page, I need to eliminate some content on the order form because the IE header and footer take up valuable rows .

I must accept defeat on this one.
Regards
Awestruck

  Kemistri 27 Apr 09

If you have a space issue, could you not make a bit of a space saving in your print stylesheet? Less padding in or around form inputs, for instance? Lots of potential for incremental reduction.

Incidentally, if your website has no headers or footers, where are your title, copyright notice, etc etc.? Just wondering.....

  Awestruck 30 Apr 09

Hello Kemistri

Good point! I will try eliminating padding and unnecessary spaces in the print style sheet.

many thanks

Awestruck

Advertisement

This thread is now locked and can not be replied to.

Should I upgrade to Windows 10? 8 reasons why you should upgrade to Windows 10... and 2 why you…

We are being sold the ability to spend money we don't have. And we love it

Microsoft claims its new VR lens system is better than Oculus Rift's

Apple Music preview: Why Spotify should be scared of Apple's impressive new music-streaming service

We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message