5

Is there any way to remove header and footer of a html page, so that if user print it, there is no header and footer.

User can choose to remove it using print setup, but i wondering is there any css or javascript to remove it programatically?

thank you for any response.

Ifnu
  • 127
  • 3
  • 7

3 Answers3

4

I do some googling and everybody said: "Can't remove them!" except using ActiveX and 3rd party plugins.

I wonder why some reporting controls (Telerik Reporting, DevX,...) can hide Header & Footer without using ActiveX or plugins! Are they print the page in another ways? What way?

Vinh
  • 1,217
  • 2
  • 9
  • 9
  • Telerik is generating a PDF server side and setting iframe src=PDF_URL. The PDF itself has a javascript print command embeded in it, which triggers the browser print dialog. – Garfield Apr 17 '12 at 18:33
  • 1
    Correction: it triggers the PDF plugin print dialog, not the browser print dialog. That is how they avoid those pesky browser headers. – Garfield Apr 17 '12 at 18:41
3

You seem to be referring to the header and footer lines that the browser is adding and not contents of the printed page. In that case the answer is: No, you can only change it in the settings.

RoToRa
  • 37,635
  • 12
  • 69
  • 105
0

You can do like:

   @media print
   {
      .noprint { display: none; }
   }

Now you can apply the noprint class to element you want to hide in printing.

Sarfraz
  • 377,238
  • 77
  • 533
  • 578