Skip to content
Anivia1337Public

About

Browser-based label editor and printer for the Brother PT-P700 on Linux – P-touch Editor replacement, no drivers

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Label Editor for the Brother PT-P700 (Linux, browser-based)

A free replacement for Brother's P-touch Editor that runs on Linux: design labels with text, symbols, dates, images, barcodes, QR codes, shapes and frames in the browser and print them on a Brother PT-P700 — without Brother drivers, without CUPS, without installing anything. In the simplest case all you need is Chromium.

Works with every TZe tape width (3.5 / 6 / 9 / 12 / 18 / 24 mm) and HSe heat-shrink tubes, reads the loaded tape from the printer automatically, and supports numbering and CSV merge for label series.

The whole app is this folder: static HTML/JS plus an optional 300-line Python server. It is built to live under /ptouch/ on any web server (for example GitHub Pages) or to be served locally by server.py.

Features

  • Tapes: TZe 3.5 / 6 / 9 / 12 / 18 / 24 mm and heat-shrink tubes HSe 2:1 and 3:1, with the print areas from Brother's raster specification. Optional "extended print area" (the pin counts used by ptouch-print).
  • Automatic tape detection: the app reads the printer status on start-up, on plug-in, when opening New / Print and every 30 s, and switches the label to the loaded tape (can be turned off).
  • Label: automatic or fixed length, margins, feed, tape colour preview, portrait design (cable wraps, vertical labels).
  • Text: any system font, auto size that fills the tape height, bold / italic / underline / strikethrough, alignment, line spacing, letter spacing, outline / shadow / inverted / mirrored, vertical text, text frames, repetitions (cable wrap).
  • Barcodes: Code 128, Code 39, EAN-13, EAN-8, UPC-A, ITF; QR codes with selectable error correction. Module widths in whole printer dots so bars stay sharp.
  • Images: PNG / JPG / SVG with Floyd–Steinberg, Atkinson, Bayer or threshold conversion, brightness, contrast, invert.
  • Shapes and frames: rectangle, rounded, ellipse, line; nine frame styles bound to the print area.
  • Placeholders: {N} / {N:4} numbering, {datum} / {date:YYYY-MM-DD}, {zeit} / {time}, {ColumnName} from a CSV table (mail-merge labels).
  • Templates: text, two lines, framed, address, name badge, barcode, QR with text, folder spine, date, inventory, cable flag, cable wrap, patch panel, faceplate, portrait.
  • Editor: drag, resize handles, rotation, snapping to edges and centres, rulers in mm, zoom, layers, align, duplicate, copy/paste, undo/redo, print preview in real printer dots.
  • Printing: copies, numbering, record ranges, auto cut, chain printing, special tape (no cut), mirror, tape check by the printer, status query.
  • Saving: in the browser (localStorage) and as .label.json files.
  • UI in English and German, light and dark theme.

Quick start

  1. Turn off P-touch Editor Lite on the printer (see below) and install the udev rule.
  2. Either open the hosted app in Chromium and print via WebUSB, or run python3 server.py in this folder and open http://localhost:7700.

Prepare the printer

  1. Editor Lite off. Out of the box the PT-P700 shows up as a USB stick ("P-touch Editor Lite", USB ID 04f9:2064) and ignores print data. Hold the Editor Lite button on the printer until the green LED goes off. It then enumerates as 04f9:2061 and Linux creates /dev/usb/lp0.

  2. Permissions.

    sudo cp linux/70-brother-ptouch.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules && sudo udevadm trigger
    

    Replug the cable. (Membership in the lp group is enough for /dev/usb/lp0, but not for WebUSB.)

Three ways to print

A – USB direct (WebUSB). Open the page in Chromium / Chrome / Edge (HTTPS or localhost), choose USB direct in the print dialog and grant the printer in the browser prompt.

One-time setup: set chrome://flags/#automatic-usb-detach to Enabled and restart the browser. Only then may Chromium detach the usblp kernel driver (it re-attaches it after printing). Without the flag the print fails with "Unable to claim interface". On Arch you can also put --enable-features=AutomaticUsbDetach into ~/.config/chromium-flags.conf. Alternatives: sudo rmmod usblp (until reboot) or the commented-out unbind rule in linux/70-brother-ptouch.rules — but then there is no /dev/usb/lp0 for way B. Snap Chromium additionally needs sudo snap connect chromium:raw-usb. Firefox has no WebUSB — use B.

B – local server. In this folder run

   python3 server.py

and open http://localhost:7700. The server serves the app and writes print jobs to /dev/usb/lp0 (Python ≥ 3.7, standard library only). A hosted copy of the app also finds a running local server (CORS is open). linux/ptouch-editor.sh starts server and browser together; linux/ptouch-editor.desktop is a matching menu entry (adjust the path in Exec= and copy it to ~/.local/share/applications/).

C – file. Save file (.prn) produces the finished raster job:

   cat label.prn > /dev/usb/lp0
   # or through a CUPS raw queue
   lp -o raw -d PT-P700 label.prn

Hosting it yourself

The page references its assets with absolute /ptouch/... paths. Keep the folder name ptouch (a GitHub Pages project called ptouch works out of the box at https://<user>.github.io/ptouch/), or serve it with server.py, which strips that prefix. WebUSB needs HTTPS or localhost. .htaccess holds the headers for Apache; other servers ignore it.

Technical notes

  • Raster protocol from Brother's Software Developer's Manual – Raster Command Reference PT-H500/P700/E500: invalidate, ESC @, ESC i a 01, ESC i z (tape width, raster count), ESC i M (auto cut), ESC i K (chain printing / special tape), ESC i d (feed), M 02 (TIFF / PackBits), G n1 n2 … per raster line, Z for blank lines, 0C / 1A as page end. 128 pins, 180 dpi, 16 bytes per line; image row y lands on bit (left offset + y) — the same mapping ptouch-print and brother_ql use.
  • The 32-byte status (ESC i S) provides model, tape width, media type, tape colour and errors; tape detection is built on it.
  • Should also work with other 128-pin / 180-dpi P-touch models that speak the same raster protocol (PT-P750W, PT-H500, PT-E500, PT-P710BT); the udev rule already lists their USB IDs. Only the PT-P700 is the design target.
  • Verified against the specification (PackBits example from the manual, command sequence of the sample job) and cross-checked with ptouch-print and brother_ql; Code 128 and Code 39 tables checked against JsBarcode. Please open an issue if a print comes out shifted, mirrored or uncut — the first physical test should be a short label.
  • Files: index.html, stil.css, js/medien.js (tapes, templates), js/barcode.js (1D codes), js/raster.js (protocol), js/render.js (drawing, text layout, dithering), js/editor.js (interaction), js/transport.js (WebUSB, server, file), js/app.js (UI), js/i18n.js (strings), vendor/qrcode.min.js (qrcode-generator, MIT), server.py, linux/.

Credits

  • Brother Industries for publishing the raster command reference.
  • ptouch-print and brother_ql — the two working implementations this protocol code was checked against.
  • qrcode-generator by Kazuhiko Arase (MIT).

License

MIT — see LICENSE.


Deutsch: Ein Ersatz für den P-touch Editor unter Linux — Etiketten im Browser entwerfen und direkt auf dem Brother PT-P700 drucken (WebUSB in Chromium, lokaler server.py oder .prn-Datei). Vorher am Drucker Editor Lite ausschalten und die udev-Regel installieren; für WebUSB einmalig chrome://flags/#automatic-usb-detach aktivieren. Die Oberfläche ist auch auf Deutsch verfügbar.

About

Browser-based label editor and printer for the Brother PT-P700 on Linux – P-touch Editor replacement, no drivers

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages