Added support for vinted labels
All checks were successful
DNSControl / build (push) Successful in 3m26s

This commit is contained in:
fleaz 2025-05-25 15:55:42 +02:00
parent 125d6eaf7c
commit ef3421ff97
Signed by: fleaz
GPG key ID: 935474624265FE8F
4 changed files with 54 additions and 3 deletions

View file

@ -50,3 +50,27 @@ def convert_hermes(id):
with open(f"./downloads/{id}.pdf", "wb") as fh:
writer.write(fh)
def convert_vinted(id):
with open(f"./uploads/{id}.pdf", "rb") as fh:
reader = PdfReader(fh)
writer = PdfWriter()
numPages = len(reader.pages)
if numPages != 1:
exit(1)
#page = reader.pages[0].rotate(90)
page = reader.pages[0]
left = 18
bottom = 150
right = 315
# calculate last value to get a 3:2 rectangle
top = bottom+((right-left)/2)*3
page.mediabox = RectangleObject((left, bottom,right,top))
writer.add_page(page)
with open(f"./downloads/{id}.pdf", "wb") as fh:
writer.write(fh)