- Python 47%
- JavaScript 41.9%
- Shell 6.6%
- C 2.9%
- Dockerfile 1.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| cups-legacy | ||
| docker | ||
| linux | ||
| printer-app | ||
| replacement/src/js | ||
| .env.example | ||
| apply-pm64d.py | ||
| bootstrap-local.sh | ||
| CHANGES-V2.txt | ||
| CHANGES-V3.txt | ||
| CHANGES-V4.txt | ||
| CHANGES.txt | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
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.pdfextracts the actual DHL shipping label from page 2 and creates a 102x152 mm PNG plus PDF.pm64d-print.py INPUT.png --output OUTPUT.tsplconverts a PNG, JPEG, or the first page of a PDF into PM64D TSPL. The output is always102x152 mmat 203 dpi.lp -d PM64D-PPD -o PageSize=Label102x152 INPUT.pngsends 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.