From d789d102d928604f44fc38fa030a73f36278acc7 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 13 Dec 2024 16:07:39 +0100 Subject: [PATCH] Changed docu to fit function --- README.md | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8f47442..30f2bf4 100644 --- a/README.md +++ b/README.md @@ -241,26 +241,31 @@ it to the InvenTree Label templates as usual. Add a command to the template's me ``` 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 +it calls the render_to_string function of the template and send the result to the printer. The result can look like: +![Label Example](https://github.com/SergeoLacruz/inventree-zebra-plugin/blob/master/pictures/example_label.png) + +This is the template to create the label: + ``` {% 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 +^FT320,25^A0N,18,22^FD{{ item.pk }}^FS +^FT100,70^FB200,2,,C,,^A0N,18,22^FD{{ part.name }}^FS +^FT100,100^FB200,1,,C,,^A0N,18,22^FD{{ part.manufacturer_parts.first.manufacturer.name }}^FS +^FT30,150^FB340,1,,C,,^A0N,30,40^FD{{ part.IPN }}^FS +^FT20,210^FB360,3,,L,,^A0N,18,22^FD{{ part.description }}^FS +^FT15,110^BQ,2,3^FDQA,{{ part.IPN }}^FS +^FT310,130^BQ,2,3^FDQA,{{ qr_data }}^FS {% endautoescape %} ``` Autoescape must be off in that case. We do not need " and similar escapes here. -The context variables are object.xxx for the object to be printed and context.xxx for -the printing context. Limitation: ZPL commands starting with backslash like \& cannot -be used so far. +Context variables can be used as usual. + +!!! warning "Linitation" + ZPL commands starting with backslash like \& cannot be used so far. Happy printing.