Cab label printer plugin for InvenTree
Project description
inventree-cab-plugin
A label printing plugin for InvenTree, which provides support for the Cab label printers.
This plugin supports printing to cab printers using FTP. It was only tested on the MACH 4S model but should work on other models with similar capabilities.
Installation
Add the following line to plugins.txt
for automatic installation using the invoke install
command:
install inventree-cab-plugin
Or install manually with:
pip install inventree-cab-plugin
For further development, can also setup an editable install (see InvenTree documentation).
An example using the InvenTree docker (see InvenTree documentation):
# Setup InvenTree development docker
git clone https://github.com/inventree/InvenTree.git && cd InvenTree
docker compose run inventree-dev-server invoke update
docker compose run inventree-dev-server invoke setup-test --dev
docker compose up -d
# Install plugin inside docker container
docker ps
# Note the `NAME` or `CONTAINER ID` unique prefix for inventree-dev-server container
docker exec -it inventree-inventree-dev-server-1 /bin/sh
# In shell inside docker
source data/env/bin/activate
# Copy plugin code to data/plugins/ folder on host (same folder is already mounted inside docker)
cd ./data/plugins/inventree-cab-plugin
pip install --editable .
Configuration Options
In InvenTree Web GUI (In docker development environment accessible on http://localhost:8000), go to the settings page and then to the plugin settings section.
If run InvenTree inside docker, should toggle the Check plugins on startup
setting and restart (docker compose restart
) if it was not enabled.
Afterward can enable the Cab Labels plugin and access its settings. The IP Address of the printer should be entered for the plugin to work. The other settings should be modified according to the printer settings.
Printing Options
When select stock items to print labels for, can select a label template. On InvenTree administration page can upload new label template e.g., Stock Item Label (in dev. environment at http://localhost:8000/admin/label/stockitemlabel/).
Here can click on ADD STOCK ITEM LABEL
, give the label a name, select a file and configure the other desired parameters like the width and height, then save.
An example jscript is shown below. Upload it as an html label template to inventree as described above.
For other examples can refer to the Programming cab printer PDF that can be found online e.g. from cab website. There is also a jscript programming manual available from cab website.
The variables in {{ }}
are from the django template language (see django documentation).
; Set [m]easurements to [m]illimeters
m m
; Create a [J]ob
J
; [S]et Label Size
; S [start detection;] displacement to the right, displacement downwards, height, height + gap, width
; S l1; 0, 0, 30, 32, 60
; using {{ height }} {{ width }} params configured when uploaded template jscript
; S l1; 0, 0, {{ height }}, {{ height|add:2}}, {{ width }}
; W:[refrence;] , x position, y position, rotation, width, height, font, size; text
W:Titlebox; 1, 1, 0, {{ width }}, 6, 3, 3; <HTML>
<h2>Company</h2>
</HTML>
; Barcode
; B [name;] x, y, r, type[+options], size; content
; NOTE: IF write CODE128 will print text of barcode below, but not if write CODE128
; with code128 need to specify height, width smallest bar
B 1, 7, 0, code128, 8, 0.2; {{ qr_data }}
; W: x, y, rotation, width, height, font, size; text
W:Textbox; 1, 15, 0, {{ width }}, 12, 3, 2;<HTML>
<p>SN: {{ serial }}</p>
<p>PN: {{ part.IPN }}</p>
<p>{{ part.name }}</p>
</HTML>
; Print one label
; A 1
; Preview at https://PRINTER_IP/cgi-bin/bitmap
A [preview]
If use the preview command A [preview]
toggle the preview option before printing in inventree.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file inventree-cab-plugin-0.1.0.tar.gz
.
File metadata
- Download URL: inventree-cab-plugin-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d7a12c5c77065a7117d77e217f20d48c4cda794ec690b294fe94322575a0f90 |
|
MD5 | 592a07a4db6de1b49f1a37a8ee313a75 |
|
BLAKE2b-256 | 95037f341d883054b8e4655adec703f01e6138e258f99271aa8a2f577952fa7d |
File details
Details for the file inventree_cab_plugin-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: inventree_cab_plugin-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a76d496ffe7b1ee0f197667f684ed344aa6a75a260709cc9bdefc5f8130f15a0 |
|
MD5 | 5ab176fe7c3b82f5f508a32e46bb5da0 |
|
BLAKE2b-256 | b1a889f76a2d88f223942dd694217e9d0d3b7600210416095db17a5195e31c64 |