5

Inspired by the corresponding question for pdftex, I want to set the pdf timestamp in the metadata in ConTeXt.

What didn't work so far:

% Set the luatex variables, applies only to \date
\ctxlua{
pt=string.gmatch('2018-04-22','[^-]+');
tex.year=tonumber(pt());
tex.month=tonumber(pt());
tex.day=tonumber(pt());
}

% set the PDF metadata, but the time isn't set.
\setupinteraction[state=start, title={This gets shown}, date=2018-04-22T15:42:12+01:00]

\starttext
\date % April 22, 2018
\stoptext

Here the set data is displayed correctly, but the pdf timestamp is still the current date.

4

After some looking through lpdf-ini.lua, lpdf-xmp.lua and back-ini.lua I've found a way to change the metadata:

% Change PDF metadata timestamp, 
\startluacode
local metadata = lpdf.getmetadata();
metadata['time'] = '2018-04-22T15:42:12+01:00';
\stopluacode

This doesn't touch the \currentdate set by TeX, so you can have different dates for \date and the metadata. The date format is PDF specific, so this will break other output formats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.