The headers and footers printed when a web page is printed in Internet Explorer is defined in the IE Page Setup dialog - a number of meta commands are available for including page numbers and dates etc - but then you knew that.
When printing an html document or report in a corporate environment or on specialist pages from web sites (e.g. printing a post card) it can be desirable to use headers/footers appropriate to the report or remove the headers and footers altogether, but only for the particular report/page.
ScriptX is an ActiveX control from MeadCo that provides this control, and much more. For just controlling the headers and footers it is free.
1. Include the ScriptX object on the page, either in the <head> or <body> sections of the document:
<!-- MeadCo ScriptX Control -->
<object id="factory" style="display:none" viewastext
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=6,2,433,14">
</object>
(The installation cab file can be downloaded from your own servers).
2. Initialise the required print parameters in the onload event with a little bit of javascript:
<script language="jscript">
function initPrinting() {
factory.printing.header = "ScriptX Printing";
factory.printing.footer = "";
}
</script>
<body onload="initPrinting()">
...
</body>
</html>
Now, when the user chooses print (either from the File menu or via some scripted button), the page will be printed with the defined headers. When the user navigates away from the page their default print settings will be restored.