From 7160f1628d9aa34e3eea99cfa5285275daf37a3b Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Wed, 10 Feb 2016 09:32:38 +0100 Subject: [PATCH] fix parsing of dpi and % units --- src/img2pdf.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index bf2ce48..8f7f3ed 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -930,7 +930,13 @@ def parse_imgsize_num(num, name): if unit is None: unit = ImgUnit.pt else: - num = num[:-2] + # strip off unit from string + if unit == ImgUnit.dpi: + num = num[:-3] + elif unit == ImgUnit.perc: + num = num[:-1] + else: + num = num[:-2] try: num = float(num) except ValueError: @@ -1396,7 +1402,7 @@ values set via the --border option. '--creator', metavar='creator', type=str, help='Sets the creator metadata value') metaargs.add_argument( - '--producer', metavar='producer', type=str, default="img2pdf" + '--producer', metavar='producer', type=str, default="img2pdf", help='Sets the producer metadata value (default is: img2pdf)') metaargs.add_argument( '--creationdate', metavar='creationdate', type=valid_date,