initial commit
This commit is contained in:
commit
1c0711893e
7 changed files with 892 additions and 0 deletions
29
paperless_asn_qr_codes/main.py
Normal file
29
paperless_asn_qr_codes/main.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import argparse
|
||||
|
||||
from reportlab.lib.units import mm, cm
|
||||
from reportlab_qrcode import QRCodeImage
|
||||
from paperless_asn_qr_codes import avery_labels
|
||||
|
||||
def render(c,x,y):
|
||||
global startASN
|
||||
barcode_value = f"ASN{startASN:07d}"
|
||||
startASN = startASN + 1
|
||||
|
||||
qr = QRCodeImage(barcode_value, size=y*0.9)
|
||||
qr.drawOn(c,1*mm,y*0.05)
|
||||
c.setFont("Helvetica", 2*mm)
|
||||
c.drawString(y, (y-2*mm)/2, barcode_value)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='paperless-asn-qr-codes',
|
||||
description='CLI Tool for generating paperless ASN labels with QR codes')
|
||||
parser.add_argument('start_asn')
|
||||
parser.add_argument('output_file')
|
||||
args = parser.parse_args()
|
||||
global startASN
|
||||
startASN = int(args.start_asn)
|
||||
label = avery_labels.AveryLabel(4731)
|
||||
label.open(args.output_file)
|
||||
label.render(render, 189 )
|
||||
label.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue