diff --git a/SergeoLacruz.html b/SergeoLacruz.html new file mode 100644 index 00000000..0eeb0a62 --- /dev/null +++ b/SergeoLacruz.html @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + +InvenTree - Sergeolacruz + + + +Sergeolacruz | InvenTree + + + + + + + + + + + + + + + + + + + +
+
+
+ + logo + InvenTree + + +
+ + + + +
+
+ +

+
+ +
+ mdo +
+ + Michael +
+

+ +
+ +GitHub + + + + + + +
+ +
+ + +
+ + + + + + +

Plugins

+ + +
+ +
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/SergeoLacruz/inventree-zebra-plugin.html b/SergeoLacruz/inventree-zebra-plugin.html new file mode 100644 index 00000000..48ac436b --- /dev/null +++ b/SergeoLacruz/inventree-zebra-plugin.html @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + +InvenTree - Inventree Zebra Plugin + + + +Inventree Zebra Plugin | InvenTree + + + + + + + + + + + + + + + + + + + + +
+
+
+ + logo + InvenTree + + +
+ + + + +
+
+ +

inventree-zebra-plugin + + +by mdo SergeoLacruz + +last modified: 29 Jan 2023 +

+ +
+
+

Zebra Label Printer Plugin for Inventree

+ +

This is a label printing plugin for InvenTree, which provides support for Zebra Label printers . +It supports printing to just GK420T with one label size (50x30) so far. So it is very simple. It uses the zpl library to +convert the png data provided by InvenTree to Zebras bitmap format.

+ +

It can output the print data either to a local printer connected to the computer via USB or to a network printer +with an IP address. The output can be configured in the InvenTree plugin user interface. So the source code is +a good example for this.

+ +

Error handling is very basic.

+ +

Installation

+ +

Install this plugin using pip with the following command::

+ +
pip install git+https://github.com/SergeoLacruz/inventree-zebra-plugin
+
+ +

Configuration Options

+

Printer Interface

+

Here you can chose between Local printer or network printer. Default value is a local printer.

+ +

IP address

+

In case you use an IP printer set the IPv4 address here.

+ +

Port

+

In case you use an IP printer set the port number here. The default port number is 9100.

+ +

Local Device

+

In case of a local printer set the device here. The plugin actually puts the data directly to the +device libe /dev/usb/lp0. No printer spooler is involved so far.

+ +

How it works

+

First import all the stuff you need. Here we use the translation mechanism from django for multi language support. +The import the InvenTree libs and everything you need for plugin. Here we have zpl for the Zebra bitmaps and socket +for the IP connection to the printer.

+ +

The next part is this:

+ +
class ZebraLabelPlugin(LabelPrintingMixin, SettingsMixin, IntegrationPluginBase):
+
+    AUTHOR = "Michael Buchmann"
+    DESCRIPTION = "Label printing plugin for Zebra printers"
+    VERSION = ZEBRA_PLUGIN_VERSION
+    NAME = "Zebra"
+    SLUG = "zebra"
+    TITLE = "Zebra Label Printer"
+
+ +

The name of the class can be freely chosen. You reference to it in the entry_points section of the setup.py file. +The parameters need to be like in the example. Then there is the description block. The keywords are fixed and +need to be like that. The values are found in the UI as shown in the pictures below.

+ +

Admin +Config

+ +

Then we add the configuration parameters.

+
SETTINGS = {
+        'CONNECTION': {
+            'name': _('Printer Interface'),
+            'description': _('Select local or network printer'),
+            'choices': [('local','Local printer e.g. USB'),('network','Network printer with IP address')],
+            'default': 'local',
+        },
+        'PORT': {
+            'name': _('Port'),
+            'description': _('Network port in case of network printer'),
+            'default': '9100',
+        },
+    }
+
+
+ +

We need to define a dict with the name SETTINGS. Please be aware the keys need to be in all CAPITAL letters like CONNECTION. +Simple parameters are just text strings like the port. We can set a default. The name and description shows up in the UI. +Instead of ta simple test we can also use choices. The first string like “local” it the key you use in the code. The second +one is the description in the UI. +After that we need to define a function:

+ +
def print_label(self, **kwargs){
+
+ +

The kwargs is a dict with the following keys:

+ +
    +
  • pdf_data
  • +
  • user
  • +
  • filename
  • +
  • label_instance
  • +
  • width
  • +
  • height
  • +
  • png_file
  • +
+ +

For the Zebra printer we use the png_file. This is a PIL (python Pillow) object with the graphic of the label in PNG format. +The PIL object is a greyscale image. Because the printer can just print pure BW we convert this to a BW picture.

+ +
fn = lambda x : 255 if x > Threshold else 0
+label_image = label_image.convert('L').point(fn, mode='1')
+
+ +

The threshold can by modified by a plugin parameter. 200 is a good starting value. This trick gives much better prints. +We can put the result this directly into the zpl library.

+ +
l = zpl.Label(50,30,8)
+l.origin(0, 0)
+l.write_graphic(label_image, 50)
+l.endorigin()
+
+ +

50,30 is the size of the label in millimeters. The third parameter is the resolution of the printer in +dots per mm. As the Zebra printer has 200dpi we put an eight here. write_graphic converts the pillow data +to zpl. 50 is the with of the image in mm.

+ +

The plugin was tested with a label of 50x30 mm defined using css and html in InvenTree as shown below. The DPI scaling +can be chosen in the InvenTree settings. 400 is a good value because it is just double of the printers +resolution. If you save the pillow data to a png file you get a size of 788x473 which fits well to that data.

+ +
<style>
+    @page {
+        width: 50mm;
+        height: 30mm;
+        padding: 0mm;
+        margin: 0px 0px 0px 0px;
+        background-color: white;
+    }
+
+ +

The rest of the code is just output to the printer on different interfaces.

+ +
+ +
+

Detail section

+
+

License: + + MIT
+

+
+ Status: +
+Stable
+
+Maintained
+
+ + + + + + + +
+ +
+
+ + + + +
+ +

SergeoLacruz/inventree-zebra-plugin

+
+
+ + + + +
+ +
+ + Printer + +
+
+ +
+ +
+ + Label + + Printer + + Zebra + + ZPL + +
+
+
+
+
+ +
+ +
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/blog/feed.atom b/blog/feed.atom index 2b928f27..9c350673 100644 --- a/blog/feed.atom +++ b/blog/feed.atom @@ -1 +1 @@ -Jekyll2023-01-29T21:03:12+00:00/blog/feed.atomInvenTreeInvenTree is an open-source inventory management system which provides intuitive parts management and stock control. It is at the center of an ecosystem of addins for EDA tools, API wrapper, deeply integrated plugins and 3rd party tools.2022 in Review2023-01-02T00:00:00+00:002023-01-02T00:00:00+00:00/blog/2023/01/02/upcomingschrodingersgat0.9.0 Stable Release2022-12-12T00:00:00+00:002022-12-12T00:00:00+00:00/blog/2022/12/12/0.9.0schrodingersgatTranslating InvenTree2021-11-22T00:00:00+00:002021-11-22T00:00:00+00:00/blog/2021/11/22/translationschrodingersgatStarting with templates2021-10-25T00:00:00+00:002021-10-25T00:00:00+00:00/blog/2021/10/25/startingmatmair \ No newline at end of file +Jekyll2023-01-29T21:04:57+00:00/blog/feed.atomInvenTreeInvenTree is an open-source inventory management system which provides intuitive parts management and stock control. It is at the center of an ecosystem of addins for EDA tools, API wrapper, deeply integrated plugins and 3rd party tools.2022 in Review2023-01-02T00:00:00+00:002023-01-02T00:00:00+00:00/blog/2023/01/02/upcomingschrodingersgat0.9.0 Stable Release2022-12-12T00:00:00+00:002022-12-12T00:00:00+00:00/blog/2022/12/12/0.9.0schrodingersgatTranslating InvenTree2021-11-22T00:00:00+00:002021-11-22T00:00:00+00:00/blog/2021/11/22/translationschrodingersgatStarting with templates2021-10-25T00:00:00+00:002021-10-25T00:00:00+00:00/blog/2021/10/25/startingmatmair \ No newline at end of file diff --git a/index.html b/index.html index 89de4b71..accd935f 100644 --- a/index.html +++ b/index.html @@ -336,6 +336,39 @@
+
+ + + +
+
- -
diff --git a/matmair.html b/matmair.html index 1c9f090b..1786cad9 100644 --- a/matmair.html +++ b/matmair.html @@ -30,11 +30,11 @@ - + +{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2023-01-29T21:04:57+00:00","datePublished":"2023-01-29T21:04:57+00:00","description":"I try to build an ecosystem of reusable plugins and integrations for InvenTree. Code once and KISS!","headline":"Matmair","mainEntityOfPage":{"@type":"WebPage","@id":"/matmair"},"url":"/matmair"} diff --git a/matmair/inventree-apprise.html b/matmair/inventree-apprise.html index 9f21cbf9..d52e5878 100644 --- a/matmair/inventree-apprise.html +++ b/matmair/inventree-apprise.html @@ -31,11 +31,11 @@ - + +{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"matmair"},"dateModified":"2023-01-29T21:04:57+00:00","datePublished":"2023-01-29T21:04:57+00:00","description":"Send notifications from InvenTree via Apprise","headline":"Inventree Apprise","mainEntityOfPage":{"@type":"WebPage","@id":"/matmair/inventree-apprise"},"url":"/matmair/inventree-apprise"} diff --git a/matmair/inventree-zapier.html b/matmair/inventree-zapier.html index a2f4f61b..d5265b4b 100644 --- a/matmair/inventree-zapier.html +++ b/matmair/inventree-zapier.html @@ -31,11 +31,11 @@ - + +{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"matmair"},"dateModified":"2023-01-29T21:04:57+00:00","datePublished":"2023-01-29T21:04:57+00:00","description":"Integrate Zapier into InvenTree","headline":"Inventree Zapier","mainEntityOfPage":{"@type":"WebPage","@id":"/matmair/inventree-zapier"},"url":"/matmair/inventree-zapier"} diff --git a/news/feed.atom b/news/feed.atom index 3e1734f2..626d5b8f 100644 --- a/news/feed.atom +++ b/news/feed.atom @@ -1 +1 @@ -Jekyll2023-01-29T21:03:12+00:00/news/feed.atomInvenTree | NewsInvenTree is an open-source inventory management system which provides intuitive parts management and stock control. It is at the center of an ecosystem of addins for EDA tools, API wrapper, deeply integrated plugins and 3rd party tools.0.9.0 Release2022-12-12T00:00:00+00:002022-12-12T00:00:00+00:00/news/2022/12/12/0.9.0schrodingersgatNew Website2022-11-14T00:00:00+00:002022-11-14T00:00:00+00:00/news/2022/11/14/websiteschrodingersgatWe have news now!2022-04-23T00:00:00+00:002022-04-23T00:00:00+00:00/news/2022/04/23/news-are-startingmatmair \ No newline at end of file +Jekyll2023-01-29T21:04:57+00:00/news/feed.atomInvenTree | NewsInvenTree is an open-source inventory management system which provides intuitive parts management and stock control. It is at the center of an ecosystem of addins for EDA tools, API wrapper, deeply integrated plugins and 3rd party tools.0.9.0 Release2022-12-12T00:00:00+00:002022-12-12T00:00:00+00:00/news/2022/12/12/0.9.0schrodingersgatNew Website2022-11-14T00:00:00+00:002022-11-14T00:00:00+00:00/news/2022/11/14/websiteschrodingersgatWe have news now!2022-04-23T00:00:00+00:002022-04-23T00:00:00+00:00/news/2022/04/23/news-are-startingmatmair \ No newline at end of file diff --git a/plugins.html b/plugins.html index 567a11a0..607801c0 100644 --- a/plugins.html +++ b/plugins.html @@ -167,6 +167,39 @@ +
+ +
+ +
+ +
+ diff --git a/plugins/categories/index.html b/plugins/categories/index.html index e055f857..f52f87be 100644 --- a/plugins/categories/index.html +++ b/plugins/categories/index.html @@ -136,6 +136,10 @@ + + + + @@ -196,6 +200,10 @@ + + + + @@ -246,6 +254,41 @@ + + + +
+
+ +
+
+ + diff --git a/plugins/tags/index.html b/plugins/tags/index.html index c80381d5..d2ad8d09 100644 --- a/plugins/tags/index.html +++ b/plugins/tags/index.html @@ -138,11 +138,23 @@ + + ZPL + + + + Zapier + + + Zebra + + +

@@ -204,6 +216,10 @@ + + + + @@ -264,6 +280,10 @@ + + + + @@ -314,6 +334,10 @@ + + + + @@ -374,6 +398,10 @@ + + + + @@ -434,6 +462,10 @@ + + + + @@ -484,6 +516,41 @@ + + + +
+
+ +
+
+ + @@ -544,6 +611,10 @@ + + + + @@ -604,6 +675,10 @@ + + + + @@ -654,6 +729,41 @@ + + + +
+
+ +
+
+ + @@ -714,6 +824,10 @@ + + + + @@ -774,6 +888,66 @@ + + + + + + + + +
+

ZPL

+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
@@ -820,6 +994,66 @@ + + + + + + + + +
+

Zebra

+ +
+ + + + + + + + + + + + + + + + +
+ +
+ +
diff --git a/publishers.html b/publishers.html index 3f7e0c6a..bbfa700b 100644 --- a/publishers.html +++ b/publishers.html @@ -62,6 +62,13 @@