Skip to content

Commit

Permalink
Added docu for ZPL rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeoLacruz committed Dec 12, 2024
1 parent 8b138f4 commit 092327e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Check style
run: |
flake8 . --max-line-length=100 --ignore=E731
flake8 . --max-line-length=100 --ignore=E731,E501
publish:
if: github.event_name == 'release' && github.event.action == 'published'
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,23 @@ pixels. The darkness values are just examples. Your values will differ based on
media type and printer age. The printer head tends to wear out and the darkness value might
need an adjustment from time to time.

### Alternative
You can also bypass the InvenTree template and printing system and directly create ZPL from
the parts data. The printer knows best how to render the label and the print quality is best.
If you are interested in this way have a look at the [inventree-zpl-plugin](https://github.com/yellowcrescent/inventree-zpl-plugin)
that does exactly that.
### Direct ZPL rendering
You can also bypass the InvenTree print engine and render the label inside the printer.
The printer knows best how to render the label and the print quality is best. Inspired
by [inventree-zpl-plugin](https://github.com/yellowcrescent/inventree-zpl-plugin) a similar
function was aded to the zebra printer driver. You can write a ZPL template and upload
it to the InvenTree Label templates as usual. Add a command to the template's metadata:

```
{"zpl_template": "True"}
```

In that case the printer driver ignores the picture rendered by WeasyPrint. Instead
it loads the ZPL template, runs it through the Django rendering engine and send the
result to the printer. The result can look like:

![Example label](https://github.com/SergeoLacruz/inventree-zebra-plugin/blob/master/pictures/example_label.png)

The template file for this is [here](https://github.com/SergeoLacruz/inventree-zebra-plugin/blob/master/stockitem_50x30_zpl_001.html)

Happy printing.
Binary file added pictures/example_label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions stockitem_50x30_zpl_001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% autoescape off %}
^FT30,25^A0N,18,22^FDIPN^FS
^FT150,30^FB100,1,,C,,^A0N,24,32^FDACME^FS
^FT320,25^A0N,18,22^FD{{ object.pk }}^FS
^FT100,70^FB200,2,,C,,^A0N,18,22^FD{{ object.part.name }}^FS
^FT100,100^FB200,1,,C,,^A0N,18,22^FD{% for ma in object.part.manufacturer_parts.all %}{{ ma.manufacturer.name }}{% endfor %}^FS
^FT30,150^FB340,1,,C,,^A0N,30,40^FD{{ object.part.IPN }}^FS
^FT20,210^FB360,3,,L,,^A0N,18,22^FD{{ object.part.description }}^FS
^FT15,110^BQ,2,3^FDQA,{{ object.part.IPN }}^FS
^FT310,130^BQ,2,3^FDQA,{{ context.qr_data }}^FS
{% endautoescape %}

0 comments on commit 092327e

Please sign in to comment.