Remove the default browser header and footer when printing HTML
Asked Answered
S

5

14

I got an HTML with the <body onload="window.print()">.

The question I'm trying to ask is:

  • Is there any way to remove the strings that the web browsers add to the printed page?
  • Such as:
    • Web site from where the page was printed
    • Page count
    • Title of the web page
    • Date of printing
Spontaneous answered 1/11, 2008 at 4:31 Comment(0)
M
5

Google Docs is now skirting around this issue by generating a PDF version of your document.

If you are using Chrome, it will automatically open the PDF in a new tab and pop up the print dialog. Other browsers will prompt you to download the resultant file (which is not necessarily obvious behavior).

While I don't find this to be an elegant solution, one should be able to recreate this fairly easily using most existing web technologies.

Microstructure answered 25/3, 2011 at 18:47 Comment(0)
E
9

These a usually browser specific print settings.

In IE & FireFox for example you can go into page setup and change the header and footer details for printing.

I don't think this can be controlled by the web page itself.

Ecclesia answered 1/11, 2008 at 4:35 Comment(0)
M
5

Google Docs is now skirting around this issue by generating a PDF version of your document.

If you are using Chrome, it will automatically open the PDF in a new tab and pop up the print dialog. Other browsers will prompt you to download the resultant file (which is not necessarily obvious behavior).

While I don't find this to be an elegant solution, one should be able to recreate this fairly easily using most existing web technologies.

Microstructure answered 25/3, 2011 at 18:47 Comment(0)
W
4

You can employ an activeX-plugin if your users uses IE, an example is scriptX from Meadroid: http://www.meadroid.com/sx_intro.asp

Worldlywise answered 1/11, 2008 at 8:57 Comment(0)
T
4

For future reference:

@page {
  margin: 0;
}
@media print {
  footer {
    display: none;
    position: fixed;
    bottom: 0;
  }
  header {
    display: none;
    position: fixed;
    top: 0;
  }
}
Trope answered 23/10, 2018 at 14:58 Comment(0)
P
2

Use this css code

@page {
    margin-top: 0cm;
    margin-bottom : 0cm;
} 
Prude answered 6/9, 2019 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.