mirror of
https://github.com/entropia/paperless-asn-qr-codes.git
synced 2024-06-02 23:10:02 +00:00
feat: add support for choosing a label format
This commit is contained in:
parent
e3da948064
commit
a6b9eb5069
|
@ -10,6 +10,14 @@ for machine consumption. The labels are Avery 4731 labels.
|
||||||
pip install paperless-asn-qr-codes
|
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
|
## License
|
||||||
|
|
||||||
`paperless-asn-qr-codes` is distributed under the terms of the
|
`paperless-asn-qr-codes` is distributed under the terms of the
|
||||||
|
|
|
@ -26,16 +26,16 @@ from reportlab.lib.units import mm
|
||||||
# page size
|
# page size
|
||||||
|
|
||||||
labelInfo = {
|
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
|
# 2.6 x 1 address labels
|
||||||
5160: ( 3, 10, (187, 72), (11, 0), (14, 36), LETTER),
|
"avery5160": ( 3, 10, (187, 72), (11, 0), (14, 36), LETTER),
|
||||||
5161: ( 2, 10, (288, 72), (0, 0), (18, 36), LETTER),
|
"avery5161": ( 2, 10, (288, 72), (0, 0), (18, 36), LETTER),
|
||||||
# 4 x 2 address labels
|
# 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
|
# 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
|
# 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
|
RETURN_ADDRESS = 5167
|
||||||
|
|
|
@ -20,10 +20,13 @@ def main():
|
||||||
description='CLI Tool for generating paperless ASN labels with QR codes')
|
description='CLI Tool for generating paperless ASN labels with QR codes')
|
||||||
parser.add_argument('start_asn')
|
parser.add_argument('start_asn')
|
||||||
parser.add_argument('output_file')
|
parser.add_argument('output_file')
|
||||||
|
parser.add_argument('--format', choices=avery_labels.labelInfo.keys(), default="averyL4731")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
global startASN
|
global startASN
|
||||||
startASN = int(args.start_asn)
|
startASN = int(args.start_asn)
|
||||||
label = avery_labels.AveryLabel(4731)
|
label = avery_labels.AveryLabel(args.format)
|
||||||
label.open(args.output_file)
|
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()
|
label.close()
|
||||||
|
|
Loading…
Reference in a new issue