HTML Printing

Hello Experts,

I am now printing a document using the following code, but is there any way I can remove the header and footer that usually are printed like time, date and URL. I know that this is a browser settings, but can I do it by code?

<BODY onload="window.print(); window.close();">

Open in new window

APD TorontoAsked:
Who is Participating?
GaryConnect With a Mentor Commented:
To confirm there is no cross browser method of doing this.
Your best option is to create a pdf of the page and then you won't have this.
Rainer JeschorCommented:
as far as I know - No - this is not possible.
That what be a huge security risk/impact if you could change browser settings through Javascript.

APD TorontoAuthor Commented:
I thought so.

I have abc pdf, which I have not used in years, was 800 pixels a good width when converting to pdf, or am I imagining this number?
I don't know ABC PDF but if it has a simple HTML to PDF option with an option to fit to A4 then just use that. Or just do a convert and let the user scale the print if needed.
Screen and print are different beasts when printing,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.