Skip to main content

A library for creating and printing labels for Brother P-Touch devices

Project description

Labelprinterkit

Labelprinterkit is a Python3 library for creating and printing labels with Brother P-Touch devices. It was developed for the Networking department of KIT (Karlsruhe Institute of Technology).

Labelprinterkit's simple layout engine can be used to create simple labels:

from labelprinterkit.backends.usb import PyUSBBackend
from labelprinterkit.printers import P700
from labelprinterkit.label import Label, Text, Box, Padding
from labelprinterkit.job import Job
from labelprinterkit.constants import MediaType, MediaSize
from labelprinterkit.page import Page
from PIL import Image

# Create text for the label

text1 = Text(45, "First line", 'comic.ttf', padding=Padding(0, 0, 1, 0))
text2 = Text(25, "Some text", 'comic.ttf')
text3 = Text(25, "Other text", 'comic.ttf')

# Insert Text into boxes
box1 = Box(45, text1)
box2 = Box(25, text2, text3)

# Create label with rows from above
label = Label(box1, box2)

# Create job with configuration and add label as page
job = Job(MediaSize.W12, MediaType.LAMINATED_TAPE)
job.add_page(label)

# Create a page from a Pillow image and add it to the job
image = Image.new("1", (70, 200), "white")
page = Page.from_image(image)
job.add_page(page)

# scan for a USB printer using the PyUSBBackend
backend = PyUSBBackend()
printer = P700(backend)

# Print job
printer.print(job)

To use a Bluetooth connection:

  1. pair your device
  2. specify the serial device node when instantiating the printer:
printer = GenericPrinter(BTSerialBackend(dev_path='/dev/ttyS8'))

The following printers are currently supported:

  • Brother P-Touch PT-700 (aka P700)
  • Brother P-Touch PT-750W (aka P750W)
  • Brother H500
  • Brother E500

The following printers have been tested to mostly work, although not officially supported (their protocol is similar, although not identical):

  • Brother P-touch CUBE Plus PTP710BT

The following backends are currently supported:

  • USB Printer Device Class via PyUSB
  • Bluetooth Serial connection via PySerial
  • Network connection via TCP

The official source of this repository is at https://git.scc.kit.edu/scc-net/labelprinterkit. Pull requests and issues are also accepted on github at https://github.com/ogelpre/labelprinterkit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labelprinterkit-0.5.8.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

labelprinterkit-0.5.8-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file labelprinterkit-0.5.8.tar.gz.

File metadata

  • Download URL: labelprinterkit-0.5.8.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/6.1.35-gentoo

File hashes

Hashes for labelprinterkit-0.5.8.tar.gz
Algorithm Hash digest
SHA256 1e2959f25387f12fb10519d2b10e81129b4a63e8520e86df708341df7aaf9b89
MD5 12bc1fb2c4aa1ec505e4903abb703a21
BLAKE2b-256 0817113db8b33ab9fa36ed60e03fa01856658708df38b362adf4f3c25ec5eae1

See more details on using hashes here.

File details

Details for the file labelprinterkit-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: labelprinterkit-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/6.1.35-gentoo

File hashes

Hashes for labelprinterkit-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 8e5f58101f0dfc08c74a0b1b254db019b9800f1906e7fd307b0aa77f65b06e6a
MD5 3f161da6058d16506c65c192a1117949
BLAKE2b-256 18dcda08888e595446b39750dc745a06a5b6156fea4adeccb7f5910c32b94aca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page