I have a need to print pages from a web app on to 8" x 4" index cards. IE doesn't save print settings from one print to the next, so is there a way to programmatically force the print set up?
To resolve this issue, change the default paper size of your printer: Click Start, point to Settings, and the click Printers. Right-click the appropriate printer, and then click Properties. Click the Paper tab, and then click the paper size you want to use in the Paper Size box.
The window. print() method calls the browser's build in print support plugin to print the current DOM page. you can check the documentation, it doesn't support any argument or settings. to setup the print, you can only utilize the browser's GUI( ex. enable or disable background graphics etc.)
On the File menu, click Page Setup. In Page Setup, select a size from the Paper Size list. If you select Manage Custom Sizes from the list, you can define a custom paper size; click the plus sign to create a new paper definition, and then enter sizes for width, height, and non-printable area.
Look at this CSS3 examples from http://www.w3.org/TR/css3-page/#size:
/* style sheet for "A4" printing */
@media print and (width: 21cm) and (height: 29.7cm) {
@page {
margin: 3cm;
}
}
/* style sheet for "letter" printing */
@media print and (width: 8.5in) and (height: 11in) {
@page {
margin: 1in;
}
}
/* A4 Landscape*/
@page {
size: A4 landscape;
margin: 10%;
}
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