====== Python Barcode ====== refer: * https://github.com/hudora/huBarcode * https://sourceforge.net/projects/dmsbarcodegener/ ===== huBarcode ===== refer: https://github.com/hudora/huBarcode ==== Setup huBarcode ==== - step1: download hubarcode from https://github.com/hudora/huBarcode - step2: install python processing image: pip uninstall PIL pip install pillow - step2: build and install hubarcode: python setup.py build python setup.py install ==== 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__ == '__main__': print 'barcode generator' encoder = Code128Encoder(sys.argv[1]) encoder.save("test.png") - Step2: Run it: python barcode.py 123 Not run: barcode.py 123 Because it generate error: ImportError: No module named Image ==== Custom options in Encoder ==== Below are default options for Code128Encoder: self.options.get('show_label', True) self.options.get('ttf_fontsize', default_fontsize) self.options.get('ttf_font') self.options.get('label_border', 0) self.image_height = self.options.get('height') or (self.image_width / 3) self.options.get('bottom_border', 0) Create Custom options: options['height'] = 25 options['ttf_fontsize'] = 8 options['bottom_border'] = 2