def write(self, file, writer, registry):
if time.timezone < 0:
# divmod on positive numbers, otherwise the minutes have a different sign from the hours
timezone = "-%02i'%02i'" % divmod(-time.timezone/60, 60)
elif time.timezone > 0:
timezone = "+%02i'%02i'" % divmod(time.timezone/60, 60)
else:
timezone = "Z00'00'"
def pdfstring(s):
r = ""
for c in s:
if 32 <= ord(c) <= 127 and c not in "()[]<>\\":
r += c
else:
r += "\\%03o" % ord(c)
return r
file.write("<<\n")
if writer.title:
file.write("/Title (%s)\n" % pdfstring(writer.title))
if writer.author:
file.write("/Author (%s)\n" % pdfstring(writer.author))
if writer.subject:
file.write("/Subject (%s)\n" % pdfstring(writer.subject))
if writer.keywords:
file.write("/Keywords (%s)\n" % pdfstring(writer.keywords))
file.write("/Creator (PyX %s)\n" % version.version)
file.write("/CreationDate (D:%s%s)\n" % (time.strftime("%Y%m%d%H%M"), timezone))
file.write(">>\n")
评论列表
文章目录