1
0
Fork 0
forked from josch/img2pdf

DPI bug fix

This commit is contained in:
James R. Barlow 2016-01-16 02:58:04 -08:00
parent e90688972e
commit 50e22888ca

View file

@ -127,10 +127,19 @@ class pdfdoc(object):
# pdf units = 1/72 inch # pdf units = 1/72 inch
pdf_x, pdf_y = 72.0*width/dpi[0], 72.0*height/dpi[1] pdf_x, pdf_y = 72.0*width/dpi[0], 72.0*height/dpi[1]
print(pdf_x)
print(pdf_y)
if pdf_x < 3.00 or pdf_y < 3.00: if pdf_x < 3.00 or pdf_y < 3.00:
warning_out("pdf width or height is below 3.00 - decrease the dpi") warning_out("pdf width or height is below 3.00 - decrease the dpi")
elif pdf_x > 200.0 or pdf_y > 200.0: elif pdf_x > 14400.0 or pdf_y > 14400.0:
error_out(("pdf width or height is above 200.00 - increase the dpi") #error_out(("pdf width or height is above 200.00 - increase the dpi")
warning_out("pdf width or height would be above 200\" - squeezed inside")
x_scale = 14400.0 / pdf_x
y_scale = 14400.0 / pdf_y
scale = min(x_scale, y_scale) * 0.999
pdf_x *= scale
pdf_y *= scale
# either embed the whole jpeg or deflate the bitmap representation # either embed the whole jpeg or deflate the bitmap representation
if imgformat is "JPEG": if imgformat is "JPEG":