diff --git a/AveryLabels.py b/AveryLabels.py index 2ca7aab..becea5c 100644 --- a/AveryLabels.py +++ b/AveryLabels.py @@ -25,6 +25,7 @@ labelInfo = { # 22x 32mm x 10mm mini labels 3044: ( 2, 11, (32, 10), (2,2), (1, 1), (66.5*mm, 120.5*mm)), + 4730: ( 10, 27, (17.8*mm, 10*mm), (2.5*mm, 0), (4.5*mm, 13.5*mm), A4), # 189x 25.4mm x 10mm mini labels 4731: ( 7, 27, (25.4*mm, 10*mm), (2.5*mm, 0), (9*mm, 13.5*mm), A4), # 2.6 x 1 address labels diff --git a/main.py b/main.py index aa60fa0..77d28de 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,7 @@ from reportlab_qrcode import QRCodeImage from reportlab.pdfgen import canvas ### config ### -labelForm = 4778 +labelForm = 4730 # mode "qr" prints a QR code and an ASN (archive serial number) text mode = "qr" @@ -17,24 +17,24 @@ mode = "qr" #text="6y" # print multiple labels on a single cutout of a label sheet -subLabelsX = 2 -subLabelsY = 2 +subLabelsX = 1 +subLabelsY = 1 # what was the first ASN number printed on this sheet -firstASNOnSheet = 42 +firstASNOnSheet = 1 # how many labels have already been printed on this sheet successfully -labelsAlreadyPrinted = 20 +labelsAlreadyPrinted = 0 # how many labels have been corrupted on this sheet because of misprints -labelsCorrupted = 4 +labelsCorrupted = 0 # how many labels should be printed now -labelsToPrint = 18 +labelsToPrint = 270 fontSize = 2*mm qrSize = 0.9 qrMargin = 1*mm debug = False -positionHelper = True +positionHelper = False ### pre-calculation ### asnsAlreadyPrinted = (labelsAlreadyPrinted-labelsCorrupted)*subLabelsX*subLabelsY @@ -65,14 +65,15 @@ def render(c: canvas.Canvas, width: float, height: float): c.translate(subX, subY) if mode == "qr": - barcode_value = f"ASN{currentASN:05d}" + formatted_asn = f"{currentASN:04d}" + barcode_value = f"ASN{formatted_asn}" currentASN = currentASN + 1 qr = QRCodeImage(barcode_value, size=subLabelHeight*qrSize) qr.drawOn(c, x=qrMargin, y=subLabelHeight*((1-qrSize)/2)) c.setFont("Helvetica", size=fontSize) c.drawString(x=subLabelHeight, y=( - subLabelHeight-fontSize)/2, text=barcode_value) + subLabelHeight-fontSize)/2, text=formatted_asn) elif mode == "text": if debug: