26 lines
444 B
Python
26 lines
444 B
Python
|
import 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("%i/1.jpg" % issue)
|
||
|
x, y = cover.size
|
||
|
|
||
|
pdf = fpdf.FPDF(unit = "pt", format = [x, y])
|
||
|
|
||
|
for page in range(pages):
|
||
|
pdf.add_page()
|
||
|
pdf.image("%i/%i.jpg" % (issue, page + 1), 0, 0)
|
||
|
|
||
|
pdf.output("%i/issue.pdf" % issue, "F")
|
||
|
|