feat: enable debugging alignment with borders

This commit is contained in:
Marvin Gaube 2023-11-25 15:36:17 +01:00
parent e3da948064
commit 3dffbdb7d4
3 changed files with 9 additions and 3 deletions

View file

@ -10,6 +10,11 @@ for machine consumption. The labels are Avery 4731 labels.
pip install paperless-asn-qr-codes
```
## Tips & Tricks
In case your printer has alignment issues, you can generate a PDF with borders around the labels by using the
`--border` option.
## License
`paperless-asn-qr-codes` is distributed under the terms of the

View file

@ -43,7 +43,7 @@ BUSINESS_CARDS = 5371
class AveryLabel:
def __init__(self, label, **kwargs):
def __init__(self, label, debug, **kwargs):
data = labelInfo[label]
self.across = data[0]
self.down = data[1]
@ -51,7 +51,7 @@ class AveryLabel:
self.labelsep = self.size[0]+data[3][0], self.size[1]+data[3][1]
self.margins = data[4]
self.topDown = True
self.debug = False
self.debug = debug
self.pagesize = data[5]
self.position = 0
self.__dict__.update(kwargs)

View file

@ -20,10 +20,11 @@ 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('--border', action='store_true', help="Display borders around labels, useful for debugging the printer alignment")
args = parser.parse_args()
global startASN
startASN = int(args.start_asn)
label = avery_labels.AveryLabel(4731)
label = avery_labels.AveryLabel(4731, args.border)
label.open(args.output_file)
label.render(render, 189 )
label.close()