Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing to a Brother Label Printer from the browser

I am wanting to print labels from a Brother Label Printer from a web browser. I know DYMO has a JavaScript framework that makes printing from the browser simple. But I have customers with a Brother label printer so I need to make it work.

I've been doing some testing and some searching and it's surprising how little information is out there on this subject.

So far the only browser I have had success with is Google Chrome as it doesn't seem to print header and footers. I have installed the printer/drivers and created a custom paper size which measures 62 x 29mm.

Custom Paper Size

When I try to print, it's splitting the text over 5 labels. I have the following text on the page I am trying to print:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Print</title>
</head>
<body>

<p style="margin: 0; padding: 0; line-height: 13px; font-size: 11px; font-family: Arial; font-weight: normal; border: 1px solid #000;">Line 1<br />
Line 2</p>

</body>
</html>

But it prints 5 pages as you can see from the print que sample.

Custom Paper Size

Has anyone tackled this before or have any suggestions.


UPDATE

After changing the the margins listed in the first screenshot above to 0, it got it down to two pages. But there's still a huge margin around it:

2 Pages

like image 905
Ben Sinclair Avatar asked Feb 05 '14 07:02

Ben Sinclair


People also ask

Can I print remotely to a Brother printer?

Use Cloud Secure Print to send secure print jobs to a Brother device over the Internet.

How do I print on my Brother label maker?

[1] It's as easy as: highlight the text you want inserted into your label. click the text you want inserted into your label (click on the button with the letter "P" on the toolbar to pull highlighted information into the label creation software) print the text you want inserted into your label.

Can I email a document to my Brother printer?

You can print files by emailing them to your Brother machine. If this option is not available, update your machine's firmware. Go to your model's Downloads page at support.brother.com. You can attach up to 10 documents, 20 MB in total, to an email.

How do I access my Brother printer settings?

(Start button) => Control Panel => Hardware and Sound => Devices and Printers. Right-click your Brother machine icon and select Printer properties. NOTE: If you see the Change Properties button at the bottom left of the dialog box, click the Change Properties button before changing the settings.


1 Answers

This answer won't solve your problem in 100%. I've tested it against Safari with custom paper settings - same as ones from your example. I was testing it against printing to PDF so maybe with specific printer driver it will behave a bit different. Your example CSS and HTML are missing margin and padding reset. Here is example for @media print:

@media print {
    body, html, p {
        margin: 0pt !important;
        padding: 0pt !important;
    }
    @page {
       margin: 0pt !important;
       padding: 0pt !important;
    }
}

With this settings 2 lines of text are on one page, hover there is still some margin that can't be reduced to 0.

like image 50
Damian Krawczyk Avatar answered Sep 23 '22 13:09

Damian Krawczyk