forked from josch/img2pdf
use common variable for datetime format string
This commit is contained in:
parent
5a1f0701a3
commit
81647dd06f
1 changed files with 7 additions and 4 deletions
|
@ -95,14 +95,17 @@ class pdfdoc(object):
|
||||||
info[b"/Creator"] = b"("+creator+b")"
|
info[b"/Creator"] = b"("+creator+b")"
|
||||||
if producer:
|
if producer:
|
||||||
info[b"/Producer"] = b"("+producer+b")"
|
info[b"/Producer"] = b"("+producer+b")"
|
||||||
|
|
||||||
|
datetime_formatstring = "%Y%m%d%H%M%S"
|
||||||
if creationdate:
|
if creationdate:
|
||||||
info[b"/CreationDate"] = b"(D:"+creationdate.strftime("%Y%m%d%H%M%S").encode()+b")"
|
info[b"/CreationDate"] = b"(D:"+creationdate.strftime(datetime_formatstring).encode()+b")"
|
||||||
elif not nodate:
|
elif not nodate:
|
||||||
info[b"/CreationDate"] = b"(D:"+now.strftime("%Y%m%d%H%M%S").encode()+b")"
|
info[b"/CreationDate"] = b"(D:"+now.strftime(datetime_formatstring).encode()+b")"
|
||||||
if moddate:
|
if moddate:
|
||||||
info[b"/ModDate"] = b"(D:"+moddate.strftime("%Y%m%d%H%M%S").encode()+b")"
|
info[b"/ModDate"] = b"(D:"+moddate.strftime(datetime_formatstring).encode()+b")"
|
||||||
elif not nodate:
|
elif not nodate:
|
||||||
info[b"/ModDate"] = b"(D:"+now.strftime("%Y%m%d%H%M%S").encode()+b")"
|
info[b"/ModDate"] = b"(D:"+now.strftime(datetime_formatstring).encode()+b")"
|
||||||
|
|
||||||
if subject:
|
if subject:
|
||||||
info[b"/Subject"] = b"("+subject+b")"
|
info[b"/Subject"] = b"("+subject+b")"
|
||||||
if keywords:
|
if keywords:
|
||||||
|
|
Loading…
Reference in a new issue