Skip to main content

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.

Metadata

Release files for inventree-cab-plugin 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inventree-cab-plugin 0.1.0
File Size Uploaded
inventree-cab-plugin-0.1.0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inventree-cab-plugin 0.1.0
File Interpreter ABI Platform
inventree_cab_plugin-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / inventree-cab-plugin-0.1.0.tar.gz

Download URL inventree-cab-plugin-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6d7a12c5c77065a7117d77e217f20d48c4cda794ec690b294fe94322575a0f90
BLAKE2b-256 checksum
How to use checksums
95037f341d883054b8e4655adec703f01e6138e258f99271aa8a2f577952fa7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / inventree_cab_plugin-0.1.0-py3-none-any.whl

Download URL inventree_cab_plugin-0.1.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a76d496ffe7b1ee0f197667f684ed344aa6a75a260709cc9bdefc5f8130f15a0
BLAKE2b-256 checksum
How to use checksums
b1a889f76a2d88f223942dd694217e9d0d3b7600210416095db17a5195e31c64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page