首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Brother QL-800标签打印机打印标签

使用Brother QL-800标签打印机打印标签
EN

Stack Overflow用户
提问于 2019-04-05 00:55:14
回答 1查看 1.5K关注 0票数 2

我正在尝试使用python脚本和brother_ql库从Windows10打印标签。如何创建和打印标签?

使用PIL,我已经创建了一个我想要打印在标签上的图像。现在我想为我的兄弟QL-800标签打印机创建一个标签。

代码语言:javascript
复制
from brother_ql import BrotherQLRaster, create_label
from brother_ql.backends import backend_factory, guess_backend
from brother_ql.devicedependent import models, label_type_specs, 
label_sizes
from PIL import Image

LABEL_SIZES = [(name, label_type_specs[name]['name']) for name in 
label_sizes]
model = [m for m in models]
printer_model = model[9]  #QL-800
label_type = LABEL_SIZES[12]  #('29x90', '29mm x 90mm die-cut')

im = Image.open('tempQR.png', 'r')
im = im.resize((306, 991))
qlr = BrotherQLRaster(printer_model)

label = create_label(qlr, im, label_size='29x90', threshold=70, cut=True, 
rotate=0)
EN

回答 1

Stack Overflow用户

发布于 2020-05-13 18:02:10

我知道这是一个一年前的问题,但我还没有在互联网上找到任何张贴的文档,所以它就在这里。我自己弄清楚这一点很开心。

从这里阅读“后端”部分:http://brother-ql.net/readme.html并下载并运行windows usb驱动程序过滤器。如果你还没有读过,那整个页面都值得一读。

我已经在Windows10和运行Raspbian的Raspberry pi4上测试了这段代码。

代码语言:javascript
复制
from PIL import Image
from brother_ql.conversion import convert
from brother_ql.backends.helpers import send
from brother_ql.raster import BrotherQLRaster

im = Image.open('tempQR.png')
im.resize((306, 991)) 

backend = 'pyusb'    # 'pyusb', 'linux_kernal', 'network'
model = 'QL-800' # your printer model.
printer = 'usb://0x04f9:0x209b'    # Get these values from the Windows usb driver filter.  Linux/Raspberry Pi uses '/dev/usb/lp0'.

qlr = BrotherQLRaster(model)
qlr.exception_on_warning = True

instructions = convert(

        qlr=qlr, 
        images=[im],    #  Takes a list of file names or PIL objects.
        label='29x90', 
        rotate='90',    # 'Auto', '0', '90', '270'
        threshold=70.0,    # Black and white threshold in percent.
        dither=False, 
        compress=False, 
        red=False,    # Only True if using Red/Black 62 mm label tape.
        dpi_600=False, 
        hq=True,    # False for low quality.
        cut=True

)

send(instructions=instructions, printer_identifier=printer, backend_identifier=backend, blocking=True)

这基本上是来自brother_ql库文件"cli.py“的"print_cmd”函数。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55521301

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档