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
tex.month=tonumber(pt()); % month is ignored by ConTeXt

% 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]

\date % April 22, 2018

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


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, 
local metadata = lpdf.getmetadata();
metadata['time'] = '2018-04-22T15:42:12+01:00';

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.