Print a web page in landscape mode using javascript. While printing, I want to:
You can mark up the size and margins of a printed page with an @page
CSS rule:
/* In CSS, not JavaScript */
@page {
size: A4 landscape;
margin: 42pt 12pt;
}
@media print {
/* Define print-specific styles here, for example toning down the decoration
of hyperlinks and removing the navigation. */
a {color: inherit !important; text-decoration: none !important;}
nav {display: none;}
}
However, browser support is spotty - aside from prince XML, only IE8+ and Opera support it. If you want precise cross-browser control over printing, consider a (typically server-side) PDF output mechanism.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With