diff --git a/README.md b/README.md index 6cb65fc..8a26d8e 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,14 @@ for machine consumption. The labels are Avery 4731 labels. pip install paperless-asn-qr-codes ``` +## Supported Sheets +Some different sheet types are supported with the `--format` argument, however, not all are tested. + +Default is Avery L4731. + +Currently tested and known working are: +- Avery L4731 (DIN A4 Labels) + ## License `paperless-asn-qr-codes` is distributed under the terms of the diff --git a/paperless_asn_qr_codes/avery_labels.py b/paperless_asn_qr_codes/avery_labels.py index 91a4d28..2a94970 100644 --- a/paperless_asn_qr_codes/avery_labels.py +++ b/paperless_asn_qr_codes/avery_labels.py @@ -26,16 +26,16 @@ from reportlab.lib.units import mm # page size labelInfo = { - 4731: ( 7, 27, (25.4*mm, 10*mm), (2.5*mm, 0), (9*mm, 13.5*mm), A4), + "averyL4731": ( 7, 27, (25.4*mm, 10*mm), (2.5*mm, 0), (9*mm, 13.5*mm), A4), # 2.6 x 1 address labels - 5160: ( 3, 10, (187, 72), (11, 0), (14, 36), LETTER), - 5161: ( 2, 10, (288, 72), (0, 0), (18, 36), LETTER), + "avery5160": ( 3, 10, (187, 72), (11, 0), (14, 36), LETTER), + "avery5161": ( 2, 10, (288, 72), (0, 0), (18, 36), LETTER), # 4 x 2 address labels - 5163: ( 2, 5, (288, 144), (0, 0), (18, 36), LETTER), + "avery5163": ( 2, 5, (288, 144), (0, 0), (18, 36), LETTER), # 1.75 x 0.5 return address labels - 5167: ( 4, 20, (126, 36), (0, 0), (54, 36), LETTER), + "avery5167": ( 4, 20, (126, 36), (0, 0), (54, 36), LETTER), # 3.5 x 2 business cards - 5371: ( 2, 5, (252, 144), (0, 0), (54, 36), LETTER), + "avery5371": ( 2, 5, (252, 144), (0, 0), (54, 36), LETTER), } RETURN_ADDRESS = 5167 diff --git a/paperless_asn_qr_codes/main.py b/paperless_asn_qr_codes/main.py index 2b6e8ad..a6a951a 100644 --- a/paperless_asn_qr_codes/main.py +++ b/paperless_asn_qr_codes/main.py @@ -20,10 +20,13 @@ def main(): description='CLI Tool for generating paperless ASN labels with QR codes') parser.add_argument('start_asn') parser.add_argument('output_file') + parser.add_argument('--format', choices=avery_labels.labelInfo.keys(), default="averyL4731") args = parser.parse_args() global startASN startASN = int(args.start_asn) - label = avery_labels.AveryLabel(4731) + label = avery_labels.AveryLabel(args.format) label.open(args.output_file) - label.render(render, 189 ) + # by default, we render all labels possible on a single sheet + count = avery_labels.labelInfo[args.format][0]*avery_labels.labelInfo[args.format][1] + label.render(render, count ) label.close()