Controlling browser's print options with JavaScript?
Posted: Tue Dec 02, 2008 4:19 am
Although each browser's print options is different (for example, "Print Options" in Opera, and "Page Setup" in Internet Explorer), it seems they handle similar set of parameters, like:
- header and footer
- print margins
- paper size and orientation
Could I control those browser's parameters with JavaScript? Or better, with CSS? Internet Explorer is particularly annoying by enabling header and footer by default. Could I, for instance, write a JavaScript to disable browser's header and footer?
I'm also writing a web-based application that are supposed to print pages in exact size (A4, etc). I try to achieve the HTML page size by the following:
The code above give me exact A4 page size on screen, especially since I disable HTML page margin (<body>). Alas, when printing, the browser's margins still exist, ruining the print result. Is it possible to set browser's margins to zero (all of them; Top, Bottom, Left, Righ) using JavaScript?
- header and footer
- print margins
- paper size and orientation
Could I control those browser's parameters with JavaScript? Or better, with CSS? Internet Explorer is particularly annoying by enabling header and footer by default. Could I, for instance, write a JavaScript to disable browser's header and footer?
I'm also writing a web-based application that are supposed to print pages in exact size (A4, etc). I try to achieve the HTML page size by the following:
Code: Select all
<html>
<head>
</head>
<body>
<table border=1 style="width:29.7cm;height:21cm";border-color:black">
<tr><td>A4</td></tr>
</table>
</body>
</html>