Rename
Some checks failed
Deployment / container (push) Successful in 2m40s
Deployment / helm (push) Failing after 48s

This commit is contained in:
fleaz 2025-06-01 00:50:43 +02:00
parent 664ac6ec8c
commit eefc87bd45
Signed by: fleaz
GPG key ID: 935474624265FE8F
5 changed files with 38 additions and 10 deletions

View file

@ -51,7 +51,7 @@ def convert_hermes(id):
with open(f"./downloads/{id}.pdf", "wb") as fh:
writer.write(fh)
def convert_vinted(id):
def convert_vinted_ups(id):
with open(f"./uploads/{id}.pdf", "rb") as fh:
reader = PdfReader(fh)
writer = PdfWriter()
@ -74,3 +74,29 @@ def convert_vinted(id):
with open(f"./downloads/{id}.pdf", "wb") as fh:
writer.write(fh)
def convert_vinted_hermes(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]
left = 80
bottom = 30
right = 520
# calculate last value to get a 3:2 rectangle
top = bottom+((right-left)/3)*2
page.mediabox = RectangleObject((left, bottom,right,top))
page = reader.pages[0].rotate(270)
writer.add_page(page)
with open(f"./downloads/{id}.pdf", "wb") as fh:
writer.write(fh)