Skip to main content

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 Media
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(Media.W12)
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.

Release files for labelprinterkit 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for labelprinterkit 0.7.1
File Size Uploaded
labelprinterkit-0.7.1.tar.gz 14.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for labelprinterkit 0.7.1
File Interpreter ABI Platform
labelprinterkit-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / labelprinterkit-0.7.1.tar.gz

Download URL labelprinterkit-0.7.1.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e823d776690318ef5de4808bc2f6c420eedec4d0392db1e99c2204ccfb659072
BLAKE2b-256 checksum
How to use checksums
b0a719344052eca2aeeb74a992495afd17a28d399861b719ce81f7d8e52eae49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.5 Linux/6.1.54-gentoo

Release files / labelprinterkit-0.7.1-py3-none-any.whl

Download URL labelprinterkit-0.7.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad08f5e09f8fa58802321da985ad7aeefd2a3a5cd7ad81cee179d3a49e0d3d51
BLAKE2b-256 checksum
How to use checksums
cbb7c5807468d82249cc8a0d6697a068b8ed6c9c0353ab8b1bd9fc32cbca22bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.5 Linux/6.1.54-gentoo

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page