5
votes

I have an application where I will need to print labels from the browser. I have done this before when printing a sheet of labels (i.e. Avery 5160). This is fairly straightforward as it just requires a combination of html and css and your content and you can print the page from a normal 8.5x11 printer.

My dilemma, however, is that I need to print labels from a label printer, the kind where it prints one at a time from a roll. The specific model that will be used is a Brother QL-500. The part I am struggling with is that the number of labels to be printed will not always be the same. It could be 1, could be 4, could be 15. How can I style a page where the printer will know that each label needs to be printed individually, rather than just printing out all of the content on one long label. Does anyone know if this is actually possible / has done this before successfully?

1

1 Answers

1
votes

There is no way for a webpage to query a browser's attached printers for their paper-sizes or other attributes.

However, CSS3's Paged-Media module does allow a webpage to declare what paper sizes and orientation it expects, however as it is in Working Draft status I don't believe any browsers currently support it.

The best you can do is provide your own listing of paper sizes and use JavaScript to re-layout your page accordingly) and warn your users (in big, red, bold text preferably) that they must ensure the size selection on your page matches the printer settings exactly.

The other option is to use a system like Google Cloud Print, where the user installs a program on their computer that controls the printer (via Google) and your website would send the print request to Google instead of using the browser's own printing functionality.