Added support for vinted labels
All checks were successful
DNSControl / build (push) Successful in 3m26s
All checks were successful
DNSControl / build (push) Successful in 3m26s
This commit is contained in:
parent
125d6eaf7c
commit
ef3421ff97
4 changed files with 54 additions and 3 deletions
24
convert.py
24
convert.py
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue