fix parsing of dpi and % units

This commit is contained in:
Johannes 'josch' Schauer 2016-02-10 09:32:38 +01:00
parent 917c173bfd
commit 7160f1628d

View file

@ -929,6 +929,12 @@ def parse_imgsize_num(num, name):
raise argparse.ArgumentTypeError(msg) raise argparse.ArgumentTypeError(msg)
if unit is None: if unit is None:
unit = ImgUnit.pt unit = ImgUnit.pt
else:
# strip off unit from string
if unit == ImgUnit.dpi:
num = num[:-3]
elif unit == ImgUnit.perc:
num = num[:-1]
else: else:
num = num[:-2] num = num[:-2]
try: try:
@ -1396,7 +1402,7 @@ values set via the --border option.
'--creator', metavar='creator', type=str, '--creator', metavar='creator', type=str,
help='Sets the creator metadata value') help='Sets the creator metadata value')
metaargs.add_argument( 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)') help='Sets the producer metadata value (default is: img2pdf)')
metaargs.add_argument( metaargs.add_argument(
'--creationdate', metavar='creationdate', type=valid_date, '--creationdate', metavar='creationdate', type=valid_date,