You can Generate Barcode (image, Pdf Etc...) in Python
Example is for JPG file
from reportlab.graphics.barcode import createBarcodeDrawing, \
getCodes
def get_image(self, value, width, hight, hr, code='QR'):
""" genrating image for barcode """
options = {}
if width:options['width'] = width
if hight:options['hight'] = hight
if hr:options['humanReadable'] = hr
try:
ret_val = createBarcodeDrawing(code, value=value,
**options)
except Exception, e:
raise osv.except_osv('Error', e)
return ret_val.asString('jpg')
To get Supported barcode in your system
$ print getCodes()
reference : report lab
Example is for JPG file
from reportlab.graphics.barcode import createBarcodeDrawing, \
getCodes
def get_image(self, value, width, hight, hr, code='QR'):
""" genrating image for barcode """
options = {}
if width:options['width'] = width
if hight:options['hight'] = hight
if hr:options['humanReadable'] = hr
try:
ret_val = createBarcodeDrawing(code, value=value,
**options)
except Exception, e:
raise osv.except_osv('Error', e)
return ret_val.asString('jpg')
To get Supported barcode in your system
$ print getCodes()
reference : report lab
Thanks for sharing, this is a very difficult topic about barcode generate, very suitable for developers to learn.
ReplyDelete