This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Hierdie gesprek is in die argief. Vra asseblief 'n nuwe vraag as jy hulp nodig het.

Change print settings of browser using javascript

more options

In my PHP website I am using dot-matrix printer to print invoice bills for my costumers and use the roll paper for this. when I print using Javascript, The printer prints the contents of the bill on the paper by skipping the paper out up to A4 paper length (In my Firefox browser default print paper size is A4). But the length of the content of the bill may not be A4 length. It may less or greater than this. So in short, I need to control the paper size of the browser dynamically. The printer should stop the paper ejection on the completion of bill data.

To do this I am using Js Print Setup Add-on and adjusting paper height settings of the browser for each bills through javascript library associated with this add-on. But it is not a perfect solution because in future the add-on my not be supported by firefox. The new Firefox (Firefox Quantum) not support this addon. So I am using an older version.

I need a permanent solution and full control on printer settings of browser (via javascript code) like Printing device, paper size, margins, show or hide print dialog window, ect. And that should work independent of any add-ons.

In my PHP website I am using dot-matrix printer to print invoice bills for my costumers and use the roll paper for this. when I print using Javascript, The printer prints the contents of the bill on the paper by skipping the paper out up to A4 paper length (In my Firefox browser default print paper size is A4). But the length of the content of the bill may not be A4 length. It may less or greater than this. So in short, I need to control the paper size of the browser dynamically. The printer should stop the paper ejection on the completion of bill data. To do this I am using Js Print Setup Add-on and adjusting paper height settings of the browser for each bills through javascript library associated with this add-on. But it is not a perfect solution because in future the add-on my not be supported by firefox. The new Firefox (Firefox Quantum) not support this addon. So I am using an older version. I need a permanent solution and full control on printer settings of browser (via javascript code) like Printing device, paper size, margins, show or hide print dialog window, ect. And that should work independent of any add-ons.

All Replies (1)

more options

Don't hold your breath for this to be supported in Firefox: https://github.com/edabg/jsprintsetup/issues/39

There has been some work on CSS related to paged media, but current browser support is limited, in particular, you cannot specify that the paper is A4.

https://developer.mozilla.org/docs/Web/CSS/CSS_Pages

It sounds like for your needs you should distribute your own application, or continue to use Internet Explorer 11 with an ActiveX control.

Or can you generate PDF output?