Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interfacing to a Brother PTouch printer?

The Brother PTouch QL series of printers have USB interfaces and are capable of printing QR codes. Here's a typical model:

http://www.ptouchdirect.com/ptouch/new_ql570.html

How can I prepare input (i.e. format) for these printers and talk to them directly from my program? I'm interested in Windows, Mac, Linux platforms. Any language, a Python library would be perfect.

I don't want to generate output (e.g. CSV) and ask the user to load that into the Brother-supplied application.

like image 826
Mark Harrison Avatar asked Nov 12 '11 00:11

Mark Harrison


3 Answers

I have used the iText library for printing QR barcodes. It can generate the barcode image and put it in a PDF file, which the user can send to the printer. It is a Java based library and there is also a .NET port available.

like image 128
One-One Avatar answered Sep 28 '22 00:09

One-One


I can't speak about Windows, but Brother traditionally has very comprehensive Linux support. Here's the driver list for the PTouch models. With these drivers in place, you can print through CUPS (via the lp or lpr commands) using whatever darn file format you find is convenient for you.

OS X also uses CUPS, so printing to it would be pretty similar as on Linux... given that you can find the correct drivers.

like image 21
Charles Avatar answered Sep 28 '22 01:09

Charles


There is a brotherprint package, part of pypi:

https://pypi.python.org/pypi/brotherprint/0.1.1

It will supposedly handle sending sockets, but I have not tried it:

import re
'''Brother Python EscP Command Library
Description:
A collection of functions to more easily facilitate printing to the Brother QL label
printers without having to memorize the ESC/P commands. Also handles sending to sockets
for you.
'''
class BrotherPrint:
font_types = {'bitmap': 0,
'outline': 1}
def __init__(self, fsocket):
self.fsocket = fsocket
self.fonttype = self.font_types['bitmap']

see: https://github.com/fozzle/python-brotherprint/blob/master/brotherprint/brotherprint.py

like image 36
user391339 Avatar answered Sep 27 '22 23:09

user391339