Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Αναζήτηση στην υποστήριξη

Προσοχή στις απάτες! Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου ή να μοιραστείτε προσωπικά δεδομένα. Αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής «Αναφορά κατάχρησης».

Μάθετε περισσότερα

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.

Όλες οι απαντήσεις (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?