python:barcode
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python:barcode [2016/08/07 15:49] – [setup huBarcode] admin | python:barcode [2022/10/29 16:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Python Barcode ====== | ====== Python Barcode ====== | ||
| + | refer: | ||
| + | * https:// | ||
| + | * https:// | ||
| ===== huBarcode ===== | ===== huBarcode ===== | ||
| refer: https:// | refer: https:// | ||
| ==== Setup huBarcode ==== | ==== Setup huBarcode ==== | ||
| - step1: download hubarcode from https:// | - step1: download hubarcode from https:// | ||
| - | - step2: build and install | + | |
| + | pip uninstall PIL | ||
| + | pip install pillow | ||
| + | </ | ||
| + | | ||
| python setup.py build | python setup.py build | ||
| python setup.py install | python setup.py install | ||
| </ | </ | ||
| ==== Example create Barcode with hubarcode ==== | ==== Example create Barcode with hubarcode ==== | ||
| + | Create Firt example **barcode.py** and run it: | ||
| + | - Step1: Create **barcode.py**< | ||
| + | import sys | ||
| + | from hubarcode.code128 import Code128Encoder | ||
| + | if __name__ == ' | ||
| + | print ' | ||
| + | encoder = Code128Encoder(sys.argv[1]) | ||
| + | encoder.save(" | ||
| + | </ | ||
| + | - Step2: Run it:<code bat> | ||
| + | python barcode.py 123 | ||
| + | </ | ||
| + | barcode.py 123 | ||
| + | </ | ||
| + | ImportError: | ||
| + | </ | ||
| + | ==== Custom options in Encoder ==== | ||
| + | Below are default options for Code128Encoder: | ||
| + | <code python> | ||
| + | self.options.get(' | ||
| + | self.options.get(' | ||
| + | self.options.get(' | ||
| + | self.options.get(' | ||
| + | self.image_height = self.options.get(' | ||
| + | self.options.get(' | ||
| + | </ | ||
| + | Create Custom options:< | ||
| + | options[' | ||
| + | options[' | ||
| + | options[' | ||
| + | </ | ||
python/barcode.1470584957.txt.gz · Last modified: (external edit)
