Merge pull request #23 from lukahn/master

allow setting both, x and y at the same time and update README
This commit is contained in:
josch 2015-01-15 08:50:08 +01:00
commit 90ddbcc4df
2 changed files with 7 additions and 1 deletions

View file

@ -124,4 +124,7 @@ You can then test the converter using:
Note that the package can also be used as a library as follows:
import img2pdf
pdf_bytes = img2pdf('test.jpg', dpi=150)
pdf_bytes = img2pdf.convert(['test.jpg'], dpi=150, x=0, y=0)
file = open("name.pdf","wb")
file.write(pdf_bytes)

View file

@ -285,6 +285,9 @@ def convert(images, dpi, x, y, title=None, author=None, creator=None, producer=N
pdf_x, pdf_y = x, x*height/width
elif not x:
pdf_x, pdf_y = y*width/height, y
else:
pdf_x = x
pdf_y = y
pdf.addimage(color, width, height, imgformat, imgdata, pdf_x, pdf_y)