mirror of
https://github.com/inventree/inventree-website.git
synced 2025-04-28 05:26:44 +00:00
Added multi printer docu für Zebra label printer plugin
This commit is contained in:
parent
bf24b84a4b
commit
3fcdca481c
@ -17,12 +17,14 @@ tags: Label Printer Zebra ZPL
|
|||||||
---
|
---
|
||||||
Zebra Label Printer Plugin for Inventree
|
Zebra Label Printer Plugin for Inventree
|
||||||
|
|
||||||
This is a label printing plugin for [InvenTree](https://inventree.org), which provides support for Zebra Label printers .
|
This is a label printing plugin for [InvenTree](https://inventree.org), which provides
|
||||||
It was only tested with GK420T but should work for other ZPL printers too. It uses the ZPL library to
|
support for Zebra Label printers. It was only tested with GK420T but should work for
|
||||||
convert the png data provided by InvenTree to Zebra's bitmap format.
|
other ZPL printers too. It uses the ZPL library to convert the png data provided by
|
||||||
|
InvenTree to Zebra's bitmap format.
|
||||||
|
|
||||||
It can output the print data either to a local printer connected to the computer via USB or to a network printer
|
It can output the print data either to a local printer connected to the computer via
|
||||||
with an IP address. The output can be configured in the InvenTree plugin user interface.
|
USB or to a network printer with an IP address. The output can be configured in the
|
||||||
|
InvenTree plugin user interface.
|
||||||
|
|
||||||
Error handling is very basic.
|
Error handling is very basic.
|
||||||
|
|
||||||
@ -74,8 +76,8 @@ is passed directly to the printer without any checks. So be careful when editing
|
|||||||
here.
|
here.
|
||||||
|
|
||||||
## Label Template
|
## Label Template
|
||||||
The label needs a template described in html and css. The template should start with a page definition
|
The label needs a template described in html and css. The template should
|
||||||
that defines the label size as shown below:
|
start with a page definition that defines the label size as shown below:
|
||||||
|
|
||||||
```
|
```
|
||||||
@page {
|
@page {
|
||||||
@ -89,8 +91,27 @@ that defines the label size as shown below:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The height and width parameters are defined in the InvenTree admin panel in the label section. These values
|
The height and width parameters are defined in the InvenTree admin panel
|
||||||
have to fit the label size that is in the printer. See the example templates for details on template definition.
|
in the label section. These values have to fit the label size that is in
|
||||||
|
the printer. See the example templates for details on template definition.
|
||||||
|
|
||||||
|
## Multi printer hack
|
||||||
|
We have the requirement to print labels in different sizes. As we do not
|
||||||
|
want to change the reel for each print we set up a second printer loaded
|
||||||
|
with a different label size. InvenTree is not yet able to handle different
|
||||||
|
printers. So I added a multi printer hack. You can define a key with an IP
|
||||||
|
address in the label meta data:
|
||||||
|
|
||||||
|
```
|
||||||
|
{"ip_address":"xxx.yyy.zzz.eee"}
|
||||||
|
{"darkness":xx}
|
||||||
|
```
|
||||||
|
|
||||||
|
If the printer driver finds that key, the IP address from the printer settings
|
||||||
|
is overwritten with the address from the meta data. So the print will end up
|
||||||
|
in another printer.
|
||||||
|
|
||||||
|
Only the IP address and darkness can be overwritten so far. All other settings remain.
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
First import all the stuff you need. Here we use the translation mechanism from Django for multi language support.
|
First import all the stuff you need. Here we use the translation mechanism from Django for multi language support.
|
||||||
@ -172,7 +193,7 @@ We can put the result of this directly into the ZPL library.
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
l = zpl.Label(Height, Width, dpmm)
|
l = zpl.Label(Height, Width, dpmm)
|
||||||
l.origin(0, 0)
|
li.set_darkness(darkness)
|
||||||
...
|
...
|
||||||
l.write_graphic(label_image, Width)
|
l.write_graphic(label_image, Width)
|
||||||
l.endorigin()
|
l.endorigin()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user