-
Notifications
You must be signed in to change notification settings - Fork 0
/
pirn_code.py
25 lines (23 loc) · 1.04 KB
/
pirn_code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# A convenience class
# Report Lab API: http://www.reportlab.com/apis/reportlab/2.4/index.html
from reportlab.lib.units import inch
from reportlab.graphics.barcode import createBarcodeDrawing
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import HorizontalBarChart
import random
class PIRNCode(Drawing):
def __init__(self,
code,
code_height = 0.4*inch,
code_width = 188,
*args,
**kw):
barcode = createBarcodeDrawing('Code128',
value = code,
humanReadable = True,
barHeight = 0.2*inch,
textHeight = 10,
width = code_width,
height = code_height)
Drawing.__init__(self, barcode.width, barcode.height, *args, **kw)
self.add(barcode, name = code)