Just 做 IT

求知若饥 虚心若愚 안년하세요 (•‾̑⌣‾̑•)

Python 生成PDF417 码

3 years ago 0

安装elaphe库 此库能生成很多种条码,比如二维码,PDF417 etc


pip install elaphe

例子:

from elaphe.pdf417 import Pdf417
bc = Pdf417()
print bc.render_ps_code('PDF417')
img = bc.render('PDF417', options=dict())
img = bc.render('P^068F417', options=dict(parse=True, columns=2, rows=15), scale=2) 
img = bc.render('1234', options=dict(columns=2, rows=10), scale=2)
img = bc.render('A truncated PDF417', options=dict(columns=4, compact=True), scale=2)
img = bc.render('String error correction', options=dict(columns=2, eclevel=5), scale=2)
img = bc.render('^453^178^121^239', options=dict(raw=True, columns=2), scale=2)

img.save('/home/long/ccc.png', 'png')

Write a Comment