Giter Club home page Giter Club logo

pt-p710bt-label-maker's Introduction

P-Touch Cube (PT-P710BT) label maker - With MQTT support

Fork of https://github.com/SkoZombie/pt-p710bt-label-maker Fork of https://github.com/robby-cornelissen/pt-p710bt-label-maker

Key Changes in OJkaas Fork

Because I wanted to be able to automate certain label creation flows from Home Assistant, I deciced to add a MQTT listener script to the existing label printer script. This script listens to a topic and pickups text messages and automatically converts them to appropriate PNG images that can be printer to the currently installed tape.

  • Added a MQTT Topic listener that listens for a text message - Message is then automatically printer
  • Can convert received text Strings into images
  • Checks tape metadata to determine label height, so generated labels match installed tape.
  • All MQTT settings can be saved as defaults

Key Changes in SkoZombie Fork

  • Added support to use -i/--info to just query the printer information
  • Added ability to define default BT address to save typing it in each time
  • Added support for multiple tape widths (tested on 12mm)
  • Detects tape width to try to use automatically
  • Changed some function comments to be docstrings
  • Moved some legacy string formatting to f-strings
  • Updated rasterizer to support widths other than 128px

Introduction

This is a small application script to allow printing from the command line on the Brother P-Touch Cube (PT-P710BT). It is based on the "Raster Command Reference" made available by Brother on their support website. Theoretically, it should also work with other label printers that use the same command set, such as the PT-E550W and PT-P750W, but since I don't have access to these devices, I have not been able to verify this. The script converts a PNG image to the raster format expected by the label printer, and communicates this to the printer over Bluetooth.

Rationale

I wrote this script because of layout limitations encountered in the smartphone apps provided by the manufacturer. While they do make a desktop application available that seems to be more full-featured, it is only available for Microsoft Windows and Mac OS X, neither of which is my operating system of choice. In addition, I wanted the ability to execute label printing operations from the command-line to allow for easy integration with various pipelines.

Similar scripts that exist for the older P-Touch Cube (PT-P300BT), as can be found here and here, didn't completely suit my purpose, but provided helpful reference material.

Requirements and installation

The application script depends on the following packages:

  • pybluez, for Bluetooth communication
  • pypng, to read PNG images
  • packbits, to compress data to TIFF format

These can all be installed using pip:

pip install -r requirements.txt

Note that the installation of pybluez requires the presence of the bluez development libraries and libbluetooth header files (libbluetooth3-dev). For most Linux distributions, these should be available through your regular package management system.

Usage

The application can be called to print as follows:

python label_maker.py --image <image-path> <bt-address>

The expected parameters are the following:

  • image-path
    The path to the PNG file to be printed. The image needs to be the correct number of pixels high for the size of your tape. The width is variable depending on how long you want your label to be. The script bases itself on the PNG image's alpha channel, and prints all pixels that are not fully transparent (alpha channel value greater than 0).
  • bt-address
    The Bluetooth address of the printer. The bluetoothctl application (part of the aforementioned bluez stack) can be used to discover the printer's address, and pair with it from the command line:
    $> bluetoothctl
    [bluetooth]# scan on
    [NEW] Device A0:66:10:CA:E9:22 PT-P710BT6522
    [bluetooth]# pair A0:66:10:CA:E7:42
    [bluetooth]# exit
    $>
    

There are other options available, use python lable_maker.py --help to see them.

Size Information

Different sized tapes require different pixel heights to print to the tape.

The sizes apply to style TZe tapes only.

Tape Height Pixel Height
3.5mm 24
6mm 32
9mm 50
12mm 70
18mm 112
24mm 128

Limitations

In its current version, the program only prints one label at the time.

License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

pt-p710bt-label-maker's People

Contributors

ojkaas avatar robby-cornelissen avatar robbycornelissen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.