Add support for 4730
This commit is contained in:
@@ -25,6 +25,7 @@ labelInfo = {
|
|||||||
# 22x 32mm x 10mm mini labels
|
# 22x 32mm x 10mm mini labels
|
||||||
3044: ( 2, 11, (32, 10), (2,2), (1, 1), (66.5*mm, 120.5*mm)),
|
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
|
# 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),
|
4731: ( 7, 27, (25.4*mm, 10*mm), (2.5*mm, 0), (9*mm, 13.5*mm), A4),
|
||||||
# 2.6 x 1 address labels
|
# 2.6 x 1 address labels
|
||||||
|
|||||||
21
main.py
21
main.py
@@ -7,7 +7,7 @@ from reportlab_qrcode import QRCodeImage
|
|||||||
from reportlab.pdfgen import canvas
|
from reportlab.pdfgen import canvas
|
||||||
|
|
||||||
### config ###
|
### config ###
|
||||||
labelForm = 4778
|
labelForm = 4730
|
||||||
|
|
||||||
# mode "qr" prints a QR code and an ASN (archive serial number) text
|
# mode "qr" prints a QR code and an ASN (archive serial number) text
|
||||||
mode = "qr"
|
mode = "qr"
|
||||||
@@ -17,24 +17,24 @@ mode = "qr"
|
|||||||
#text="6y"
|
#text="6y"
|
||||||
|
|
||||||
# print multiple labels on a single cutout of a label sheet
|
# print multiple labels on a single cutout of a label sheet
|
||||||
subLabelsX = 2
|
subLabelsX = 1
|
||||||
subLabelsY = 2
|
subLabelsY = 1
|
||||||
|
|
||||||
# what was the first ASN number printed on this sheet
|
# 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
|
# 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
|
# how many labels have been corrupted on this sheet because of misprints
|
||||||
labelsCorrupted = 4
|
labelsCorrupted = 0
|
||||||
# how many labels should be printed now
|
# how many labels should be printed now
|
||||||
labelsToPrint = 18
|
labelsToPrint = 270
|
||||||
|
|
||||||
fontSize = 2*mm
|
fontSize = 2*mm
|
||||||
qrSize = 0.9
|
qrSize = 0.9
|
||||||
qrMargin = 1*mm
|
qrMargin = 1*mm
|
||||||
|
|
||||||
debug = False
|
debug = False
|
||||||
positionHelper = True
|
positionHelper = False
|
||||||
|
|
||||||
### pre-calculation ###
|
### pre-calculation ###
|
||||||
asnsAlreadyPrinted = (labelsAlreadyPrinted-labelsCorrupted)*subLabelsX*subLabelsY
|
asnsAlreadyPrinted = (labelsAlreadyPrinted-labelsCorrupted)*subLabelsX*subLabelsY
|
||||||
@@ -65,14 +65,15 @@ def render(c: canvas.Canvas, width: float, height: float):
|
|||||||
c.translate(subX, subY)
|
c.translate(subX, subY)
|
||||||
|
|
||||||
if mode == "qr":
|
if mode == "qr":
|
||||||
barcode_value = f"ASN{currentASN:05d}"
|
formatted_asn = f"{currentASN:04d}"
|
||||||
|
barcode_value = f"ASN{formatted_asn}"
|
||||||
currentASN = currentASN + 1
|
currentASN = currentASN + 1
|
||||||
|
|
||||||
qr = QRCodeImage(barcode_value, size=subLabelHeight*qrSize)
|
qr = QRCodeImage(barcode_value, size=subLabelHeight*qrSize)
|
||||||
qr.drawOn(c, x=qrMargin, y=subLabelHeight*((1-qrSize)/2))
|
qr.drawOn(c, x=qrMargin, y=subLabelHeight*((1-qrSize)/2))
|
||||||
c.setFont("Helvetica", size=fontSize)
|
c.setFont("Helvetica", size=fontSize)
|
||||||
c.drawString(x=subLabelHeight, y=(
|
c.drawString(x=subLabelHeight, y=(
|
||||||
subLabelHeight-fontSize)/2, text=barcode_value)
|
subLabelHeight-fontSize)/2, text=formatted_asn)
|
||||||
|
|
||||||
elif mode == "text":
|
elif mode == "text":
|
||||||
if debug:
|
if debug:
|
||||||
|
|||||||
Reference in New Issue
Block a user