Fix PDF/A validation failure due to timezone being omitted from /ModDate
This commit is contained in:
@@ -129,7 +129,9 @@ def encode_pdf_date(d: datetime) -> str:
|
||||
s += "+00'00'"
|
||||
elif tz != '':
|
||||
sign, tz_hours, tz_mins = tz[0], tz[1:3], tz[3:5]
|
||||
s += "{}{}'{tz}'".format(sign, tz_hours, tz_mins)
|
||||
s += "{}{}'{}'".format(sign, tz_hours, tz_mins)
|
||||
else:
|
||||
raise ValueError("Naive timezone not supported")
|
||||
return s
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
from contextlib import suppress
|
||||
from shutil import copyfileobj
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
@@ -900,7 +900,7 @@ def get_pdfmark(base_pdf, options):
|
||||
PROGRAM_NAME, VERSION,
|
||||
renderer_tag,
|
||||
tesseract.version())
|
||||
pdfmark['/ModDate'] = encode_pdf_date(datetime.utcnow())
|
||||
pdfmark['/ModDate'] = encode_pdf_date(datetime.now(timezone.utc))
|
||||
return pdfmark
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user