generate PDF CreationDate in local time as per PDF specification
According to section 3.8.2, pg 100 of the PDF 1.4 reference [1]:
PDF defines a standard date format, which closely
follows that of the international standard ASN.1
(Abstract Syntax Notation One), defined in ISO/IEC
8824 (see the Bibliography). A date is a string of
the form
(D:YYYYMMDDHHmmSSOHH'mm')
Whether or not the time zone is known, the rest of
the date should be specified in local time.
[1] https://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf
Change-Id: Ib375d587f983d9c70d995157f95d6a59dca037a5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
parent
062be10228
commit
b5c273cb1a
|
|
@ -1504,16 +1504,25 @@ void QPdfEnginePrivate::writeInfo()
|
|||
printString(creator);
|
||||
xprintf("\n/Producer ");
|
||||
printString(QString::fromLatin1("Qt " QT_VERSION_STR));
|
||||
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
QTime t = now.time();
|
||||
QDate d = now.date();
|
||||
xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n",
|
||||
xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d",
|
||||
d.year(),
|
||||
d.month(),
|
||||
d.day(),
|
||||
t.hour(),
|
||||
t.minute(),
|
||||
t.second());
|
||||
int offset = now.offsetFromUtc();
|
||||
int hours = (offset / 60) / 60;
|
||||
int mins = (offset / 60) % 60;
|
||||
if (offset < 0)
|
||||
xprintf("-%02d'%02d')\n", -hours, -mins);
|
||||
else if (offset > 0)
|
||||
xprintf("+%02d'%02d')\n", hours , mins);
|
||||
else
|
||||
xprintf("Z)\n");
|
||||
xprintf(">>\n"
|
||||
"endobj\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue