diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfbb5f2..5458e30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' diff --git a/README.md b/README.md index c5ad122..ce20a7b 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/pictures/example_label.png b/pictures/example_label.png new file mode 100644 index 0000000..e382b1b Binary files /dev/null and b/pictures/example_label.png differ diff --git a/stockitem_50x30_zpl_001.html b/stockitem_50x30_zpl_001.html new file mode 100644 index 0000000..4f7f9fb --- /dev/null +++ b/stockitem_50x30_zpl_001.html @@ -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 %}