1
0
Fork 0
forked from josch/img2pdf

fix regression introduced by 9b35f5cf

This commit is contained in:
josch 2014-08-24 17:15:43 +02:00
parent 82087d5506
commit 0bdf6472f8

View file

@ -197,7 +197,7 @@ class pdfdoc(object):
result += "%%EOF\n" result += "%%EOF\n"
return result return result
def convert(images, dpi, pdf_x, pdf_y, title=None, author=None, creator=None, producer=None, def convert(images, dpi, x, y, title=None, author=None, creator=None, producer=None,
creationdate=None, moddate=None, subject=None, keywords=None, creationdate=None, moddate=None, subject=None, keywords=None,
colorspace=None, verbose=False): colorspace=None, verbose=False):
@ -268,12 +268,12 @@ def convert(images, dpi, pdf_x, pdf_y, title=None, author=None, creator=None, pr
imgdata = zlib.compress(imgdata.tostring()) imgdata = zlib.compress(imgdata.tostring())
# pdf units = 1/72 inch # pdf units = 1/72 inch
if not pdf_x and not pdf_y: if not x and not y:
pdf_x, pdf_y = 72.0*width/ndpi[0], 72.0*height/ndpi[1] pdf_x, pdf_y = 72.0*width/ndpi[0], 72.0*height/ndpi[1]
elif not pdf_y: elif not y:
pdf_y = pdf_x*height/width pdf_x, pdf_y = x, x*height/width
elif not pdf_x: elif not x:
pdf_x = pdf_y*width/height pdf_x, pdf_y = y*width/height, y
pdf.addimage(color, width, height, imgformat, imgdata, pdf_x, pdf_y) pdf.addimage(color, width, height, imgformat, imgdata, pdf_x, pdf_y)