fix: produce slightly bigger numbers

This commit is contained in:
Khaïs COLIN 2024-09-01 13:53:52 +02:00
parent d7af8e0b2d
commit f5ef56f9ca
3 changed files with 11 additions and 7 deletions

4
.gitignore vendored
View file

@ -1,5 +1,5 @@
*.pdf *.pdf
/dist /dist
__pycache__ __pycache__
.direnv /.direnv
result /result

View file

@ -10,13 +10,18 @@ from paperless_asn_qr_codes import avery_labels
def render(c, x, y): def render(c, x, y):
global startASN global startASN
global digits global digits
text_height = 3 * mm
barcode_scaling_factor = 1
barcode_indent = 0 * mm;
barcode_value = f"ASN{startASN:0{digits}d}" barcode_value = f"ASN{startASN:0{digits}d}"
startASN = startASN + 1 startASN = startASN + 1
qr = QRCodeImage(barcode_value, size=y * 0.9) qr = QRCodeImage(barcode_value, size=y * barcode_scaling_factor)
qr.drawOn(c, 1 * mm, y * 0.05) qr.drawOn(c, barcode_indent, y * ((1 - barcode_scaling_factor) / 2))
c.setFont("Helvetica", 2 * mm) c.setFont("Helvetica", text_height)
c.drawString(y, (y - 2 * mm) / 2, barcode_value) c.drawString(y, (y - text_height) / 2, barcode_value)
def main(): def main():

1
result
View file

@ -1 +0,0 @@
/nix/store/ssf3fxka9p8a8qyq0955qcxxj3lnx3cy-python3.11-paperless-asn-qr-codes-0.4.0