Printing to a Brother Label Printer from the browser [UPDATED]

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 a custom paper size which measures 62 x 29mm.

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.

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:


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.

链接地址: http://www.djcxy.com/p/18898.html

上一篇: 我如何找到哪些Dll包含特定的W32函数?

下一篇: 从浏览器打印到Brother标签打印机[已更新]