Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to force printer setup (paper size) in javascript?

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?

like image 520
Chris Sobolewski Avatar asked Oct 09 '09 20:10

Chris Sobolewski


People also ask

How do I change the default printer paper size?

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.

Can I set the window print settings with JavaScript?

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.)

How can I customize my paper size?

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.


1 Answers

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%;
}
like image 194
Sayed Abolfazl Fatemi Avatar answered Sep 28 '22 06:09

Sayed Abolfazl Fatemi