window.print();
command open printing options. How do I configure it for specific options? For example, how do I open this options with 'Background graphics' as checked or layout as 'Landscape'?

- 2,303
- 3
- 16
- 24
1 Answers
You won't have access to set most of those print options, as they are operating system level details outside the browser's reach. It's not possible to directly toggle that "background graphics" checkbox, for example.
You do have some control over the appearance of your page when printed, however:
/* Background image will appear online: */
body {background-image: url('huge-image.jpg')}
@media print {
/* ...but not in print: */
body {background-image: none}
}
The CSS paged media rules should allow control over page size and print orientation, but that spec has a complicated history: it was added in CSS2, reduced in scope in CSS2.1, has been re-added as a working draft in CSS3 but was never fully supported in some browsers; at the end of the day you'll need to test the particular features you need on a case by case basis. (For landscape printing, for example, instead of trying to use @page {size: landscape}
you may need to rotate the content manually with transform: rotate()
as shown in this answer.)

- 20,653
- 5
- 38
- 53