forked from josch/img2pdf
Compare commits
3 commits
81502f21af
...
512478ac4e
Author | SHA1 | Date | |
---|---|---|---|
512478ac4e | |||
9c3753ed2b | |||
1dd05cc36b |
1 changed files with 6 additions and 3 deletions
|
@ -37,6 +37,7 @@ if hasattr(GifImagePlugin, "LoadingStrategy"):
|
|||
# TiffImagePlugin.DEBUG = True
|
||||
from PIL.ExifTags import TAGS
|
||||
from datetime import datetime
|
||||
from datetime import timezone
|
||||
from jp2 import parsejp2
|
||||
from enum import Enum
|
||||
from io import BytesIO
|
||||
|
@ -721,7 +722,8 @@ class pdfdoc(object):
|
|||
self.writer.docinfo = PdfDict(indirect=True)
|
||||
|
||||
def datetime_to_pdfdate(dt):
|
||||
return dt.strftime("%Y%m%d%H%M%SZ")
|
||||
dt_utc = dt.astimezone(tz=timezone.utc)
|
||||
return dt_utc.strftime("%Y%m%d%H%M%S+00'00'")
|
||||
|
||||
for k in ["Title", "Author", "Creator", "Producer", "Subject"]:
|
||||
v = locals()[k.lower()]
|
||||
|
@ -731,7 +733,7 @@ class pdfdoc(object):
|
|||
v = PdfString.encode(v)
|
||||
self.writer.docinfo[getattr(PdfName, k)] = v
|
||||
|
||||
now = datetime.now()
|
||||
now = datetime.now().astimezone()
|
||||
for k in ["CreationDate", "ModDate"]:
|
||||
v = locals()[k.lower()]
|
||||
if v is None and nodate:
|
||||
|
@ -751,7 +753,8 @@ class pdfdoc(object):
|
|||
)
|
||||
|
||||
def datetime_to_xmpdate(dt):
|
||||
return dt.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
dt_utc = dt.astimezone(tz=timezone.utc)
|
||||
return dt_utc.strftime("%Y-%m-%dT%H:%M:%S+00:00")
|
||||
|
||||
self.xmp = b"""<?xpacket begin='\xef\xbb\xbf' id='W5M0MpCehiHzreSzNTczkc9d'?>
|
||||
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'>
|
||||
|
|
Loading…
Reference in a new issue