Added barcode to exported PDF.

This commit is contained in:
Landon Wark
2023-05-16 09:31:23 -05:00
parent 903f403672
commit 7f0e13168a
5 changed files with 8 additions and 7 deletions

View File

@@ -1,8 +1,8 @@
from reportlab.graphics.barcode import createBarcodeDrawing, createBarcodeImageInMemory
from reportlab.graphics.barcode import createBarcodeImageInMemory
from reportlab.graphics.shapes import Drawing
from reportlab.lib.units import mm
def make_plate_barcode(text:str) -> Drawing:
def make_plate_barcode(text:str, width:int=100, height:int=25) -> Drawing:
# return createBarcodeDrawing('Code128', value=text, width=200, height=50, humanReadable=True)
return createBarcodeImageInMemory('Code128', value=text, width=100*mm, height=25*mm, humanReadable=True, format="png")
return createBarcodeImageInMemory('Code128', value=text, width=width*mm, height=height*mm, humanReadable=True, format="png")