- Reverted to <3.6 compatibility

pull/199/head
Steve Clement 2018-07-01 22:08:42 +08:00
parent 9f0313a97e
commit 549f32547d
1 changed files with 3 additions and 3 deletions

View File

@ -56,16 +56,16 @@ def handler(q=False):
with document as pdf:
# Get number of pages
pages=len(pdf.sequence)
log.debug(f"PDF with {pages} page(s) detected")
log.debug("PDF with {} page(s) detected".format(pages))
# Create new image object where the height will be the number of pages. With huge PDFs this will overflow, break, consume silly memory etc…
img = WImage(width=pdf.width, height=pdf.height * pages)
# Cycle through pages and stitch it together to one big file
for p in range(pages):
log.debug(f"Stitching page {p+1}")
log.debug("Stitching page {}".format(p+1))
image = img.composite(pdf.sequence[p], top=pdf.height * p, left=0)
# Create a png blob
image = img.make_blob('png')
log.debug(f"Final image size is {pdf.width}x{pdf.height*(p+1)}")
log.debug("Final image size is {}x{}".format(pdf.width, pdf.height*(p+1)))
else:
image = document