pyStrich¶
pyStrich ist ein schnelles, reines Python-Modul zum Erzeugen von 1D- und 2D-Barcodes. Es unterstützt die Symbologien Code 39, Code 128 (einschließlich GS1-128), EAN-13, ITF-14 (und Interleaved 2 of 5), Data Matrix (einschließlich GS1 Data Matrix), QR-Code, PDF417 und Aztec-Code. Alle acht unterstützen die Ausgabe als PNG (über Pillow), SVG und EPS. Die 2D-Formate rendern zusätzlich Terminal-Grafik und DXF für die direkte Teilekennzeichnung.
pyStrich ist ein reiner Encoder – es liest keine Barcodes.
Quellcode: https://github.com/mmulqueen/pyStrich
Installation¶
$ pip install pyStrich
Die PNG-Ausgabe benötigt Pillow; SVG-, EPS-, DXF- und Terminal-Ausgabe nicht. Installieren Sie das png-Extra, um sicherzustellen, dass Pillow vorhanden ist:
$ pip install "pyStrich[png]"
Schnellstart¶
from pystrich.datamatrix import DataMatrixData, DataMatrixEncoder
payload = DataMatrixData("https://github.com/mmulqueen/pyStrich", auto_encoding=True)
DataMatrixEncoder(payload).save_svg("datamatrix-example.svg")
Ein minimales Beispiel für jede der anderen Symbologien:
from pystrich.code39 import Code39Encoder
Code39Encoder("64755").save_svg("code39-example.svg")
from pystrich.code128 import Code128Encoder
Code128Encoder("WDBCA45D2HA327260").save_svg("code128-example.svg")
from pystrich.ean13 import EAN13Encoder
EAN13Encoder("5050070007664").save_svg("ean13-example.svg")
from pystrich.itf import ITF14Encoder
ITF14Encoder("1505007000766").save_svg("itf14-example.svg")
from pystrich.qrcode import QRCodeEncoder
QRCodeEncoder("https://github.com/mmulqueen/pyStrich").save_svg("qrcode-example.svg")
from pystrich.pdf417 import PDF417Encoder
PDF417Encoder("WDBCA45D2HA327260").save_svg("pdf417-example.svg")
from pystrich.aztec import AztecEncoder
AztecEncoder("https://github.com/mmulqueen/pyStrich").save_svg("aztec-example.svg")
Weitere Muster – Barcodes aus einer Web-Anfrage ausliefern, in großer Menge erzeugen, auf ein Etikett montieren – finden Sie unter Rezepte.
Symbologien¶
Unsicher, welche Sie wählen sollen? Siehe Die richtige Symbologie wählen.
Anleitungen¶
Referenz¶
Hintergrund¶
pyStrich war ursprünglich ein Fork von huBarcode. huBarcode wurde von HuDoRa seit mindestens 2007 entwickelt und ist seit Ende 2013 nicht mehr aktiv. Method B Ltd hat huBarcode 2015 als pyStrich geforkt, um Python 3 zu unterstützen und die Entwicklung fortzuführen. pyStrich wurde über die Jahre erheblich erweitert und ist weit über eine einfache Portierung auf Python 3 hinausgegangen. Seit 2026 ist pyStrich ein modernes Python-Paket mit vollständigem Einsatz von Typisierung, Linting und einer umfassenden Testsuite.
Dank an die Leute bei HuDoRa für die ursprüngliche huBarcode-Bibliothek, aus der pyStrich hervorgegangen ist.
Lizenz¶
Copyright various contributors to huBarcode, later pyStrich.
Main contributions are from HuDoRa from at least 2007 to 2013
Contributions since 2015 are from Method B Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Courier Prime (used to generate the glyph outlines embedded in
pystrich/_courier_glyphs.py for SVG/EPS labels) is distributed under the
SIL Open Font License, Version 1.1. The upstream license text is bundled
inline as the OFL_LICENSE constant in pystrich/_courier_glyphs.py and is
also available at courier_prime/OFL.txt in the source repository.