From 18ca3b4491d669fcd54dce9b571679b8345a7ad5 Mon Sep 17 00:00:00 2001 From: josch Date: Mon, 16 Feb 2015 07:15:10 +0100 Subject: [PATCH] make 2nd, 3rd and 4th argument optional by supplying None as default --- README.md | 2 +- src/img2pdf.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9b219a5..f97a1ee 100644 --- a/README.md +++ b/README.md @@ -124,7 +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.convert(['test.jpg'], dpi=150, x=0, y=0) + pdf_bytes = img2pdf.convert(['test.jpg']) file = open("name.pdf","wb") file.write(pdf_bytes) diff --git a/src/img2pdf.py b/src/img2pdf.py index f923e8b..a6a1adc 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -205,9 +205,9 @@ class pdfdoc(object): result += b"%%EOF\n" return result -def convert(images, dpi, x, y, title=None, author=None, creator=None, producer=None, - creationdate=None, moddate=None, subject=None, keywords=None, - colorspace=None, verbose=False): +def convert(images, dpi=None, x=None, y=None, title=None, author=None, + creator=None, producer=None, creationdate=None, moddate=None, + subject=None, keywords=None, colorspace=None, verbose=False): pdf = pdfdoc(3, title, author, creator, producer, creationdate, moddate, subject, keywords)