fread/helpers/__init__.py
Klaus-Uwe Mitterer 0b2a2c8f1f Forgot import
2017-02-08 23:55:14 +01:00

25 lines
466 B
Python

import errno, os, PIL, fpdf
def makeDir(issue):
try:
os.makedirs(str(issue))
return True
except OSError as e:
if e.errno != errno.EEXIST:
raise
return False
def makePDF(issue, pages):
cover = PIL.Image.open("%s/1.jpg" % str(issue))
x, y = cover.size
pdf = fpdf.FPDF(unit = "pt", format = [x, y])
for page in range(pages):
pdf.add_page()
pdf.image("%s/%i.jpg" % (str(issue), page + 1), 0, 0)
pdf.output("%s/issue.pdf" % str(issue), "F")