From 5c7753d6c4f8a82ccc104b001b1f7e09cd43d406 Mon Sep 17 00:00:00 2001 From: lukahn Date: Thu, 15 Jan 2015 16:15:05 +1100 Subject: [PATCH 1/2] Fix for adding custom resolutions --- src/img2pdf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/img2pdf.py b/src/img2pdf.py index 395ee31..45601b4 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -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) From d9054ddfd356bb9413c4ac2e1eccabeea8da1bb4 Mon Sep 17 00:00:00 2001 From: lukahn Date: Thu, 15 Jan 2015 16:19:18 +1100 Subject: [PATCH 2/2] Updated library section to reflect latest implementation --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ef0b405..9b219a5 100644 --- a/README.md +++ b/README.md @@ -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)