No description
  • Python 47%
  • JavaScript 41.9%
  • Shell 6.6%
  • C 2.9%
  • Dockerfile 1.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-28 13:38:03 +02:00
cups-legacy Standardize PM64D labels at 102x152 2026-09-26 21:31:44 +02:00
docker Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
linux Standardize PM64D labels at 102x152 2026-09-26 21:31:44 +02:00
printer-app Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
replacement/src/js Support CN22 and CN23 DHL customs labels 2026-09-28 13:38:03 +02:00
.env.example Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
apply-pm64d.py Support CN22 and CN23 DHL customs labels 2026-09-28 13:38:03 +02:00
bootstrap-local.sh Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
CHANGES-V2.txt Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
CHANGES-V3.txt Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
CHANGES-V4.txt Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
CHANGES.txt Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
docker-compose.yml Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
Dockerfile Initial import from typingbeaver/snake-label 2026-09-05 15:21:05 +02:00
README.md Support CN22 and CN23 DHL customs labels 2026-09-28 13:38:03 +02:00

snake-label-PM64D fork kit v5

This fork bundles the upstream typingbeaver/snake-label project with the PM64D extension, the Linux printing pieces, and a Docker deployment.

What is included

  • Docker Compose deployment for the PM64D fork
  • PM64D 102 x 152 mm output-profile patch
  • legacy CUPS PPD + raster-to-TSPL filter
  • direct Linux TSPL helper
  • PAPPL / Printer Application groundwork
  • local bootstrap script

Docker

The Docker build fetches the public upstream typingbeaver/snake-label repository and applies the included PM64D patch during the image build. The resulting web app presents this fork's branding while still running fully client-side after it has been served.

cp .env.example .env
# adjust SNAKE_LABEL_PORT if desired
docker compose build
docker compose up -d

Default URL:

http://HOST:8080

The container does not need USB access. Printing happens through the browser and the locally installed Linux/CUPS printer.

Pinning an upstream branch/tag

.env contains:

SNAKE_LABEL_REF=master

Change this to an upstream branch/tag supported by git clone --branch if you want to pin the build.

Local development fork

./bootstrap-local.sh
cd app
npm install
npm run dev

The bootstrap script clones upstream snake-label, applies the PM64D patch, and prepares the forked UI with upstream attribution in the footer.

PM64D CUPS bridge

Requirements on Arch/CachyOS:

sudo pacman -S cups python-pillow poppler

Install the PPD/filter queue:

./cups-legacy/install-legacy-cups.sh
sudo systemctl restart cups

The installer currently creates PM64D-PPD and detects usb:///PM64D?... automatically.

Check options:

lpoptions -p PM64D-PPD -l

The PM64D default is 102x152. The legacy CUPS bridge also retains alternate presets such as 100x150, 101x152/4x6-ish, 75x100, 60x40, 50x30 and 40x30 plus custom sizes.

Direct TSPL helper

The tested PM64D hardware identifies as USB 2e3c:5760 (QIN LabelPrinter) and accepts TSPL over USB/CUPS with CRLF command endings.

See linux/pm64d-print.py and linux/test-pm64d-tspl.sh.

Command API

The PM64D tools use files as their input/output API:

  • prepare-dhl-pm64d.py INPUT.pdf --png OUTPUT.png --pdf OUTPUT.pdf extracts the actual DHL shipping label from page 2 and creates a 102x152 mm PNG plus PDF.
  • pm64d-print.py INPUT.png --output OUTPUT.tspl converts a PNG, JPEG, or the first page of a PDF into PM64D TSPL. The output is always 102x152 mm at 203 dpi.
  • lp -d PM64D-PPD -o PageSize=Label102x152 INPUT.png sends an image through the CUPS PPD/filter. This is the preferred path for normal image and PDF printing because it applies the PM64D bitmap polarity correctly.

In the web app, choose DHL International NON-EU | 102x152mm under Paketlabel for the original two-page DHL PDF. The browser rotates page 2 correctly and keeps only the right-hand shipping label. It detects whether page 1 contains a CN22 or CN23 customs form, crops the colored form boundary, rotates wide CN23 forms for portrait output, and provides separate 102x152-mm PDF and PNG downloads for the shipping label and the customs declaration.

The DHL workflow therefore consists of three explicit stages: extract the label, inspect or archive the generated PNG/PDF, then print the PNG through CUPS. The original DHL PDF remains unchanged.

For DHL's two-page international PDF, extract the actual page-2 shipping label before printing it on the PM64D:

python3 linux/prepare-dhl-pm64d.py input.pdf \
  --png /tmp/dhl-pm64d-102x152.png \
  --pdf /tmp/dhl-pm64d-102x152.pdf
lp -d PM64D-PPD -o PageSize=Label102x152 /tmp/dhl-pm64d-102x152.png

Future path

printer-app/ contains the groundwork for replacing the legacy PPD/raw workflow with a modern PAPPL/IPP Printer Application. The PPD is deliberately a compatibility bridge, not the long-term architecture.