Rename
This commit is contained in:
parent
664ac6ec8c
commit
eefc87bd45
5 changed files with 38 additions and 10 deletions
28
convert.py
28
convert.py
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue