Skip to content

Commit

Permalink
Changed docu to fit function
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeoLacruz committed Dec 13, 2024
1 parent 473098e commit d789d10
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 &quot 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.

0 comments on commit d789d10

Please sign in to comment.