Using lualatex, recent TeXlive, Linux. I have searched here, and discovered that
\pdfvariable trailerid {value}
can be used for creating a specifid Info /ID in the PDF dictionary. It does work, if the value
is in proper plain text, without requiring macro expansion. But it fails if the value
is created from a macro. MWE:
\documentclass{article} % compile with lualatex
\usepackage{fontspec}
\pdfvariable compresslevel=0
\pdfvariable objcompresslevel=0
\def\yada{3a88e6fb9021cd0033aa000000000000}
\def\bada{5a88e6f44021cd0033ba000000000333}
\edef\yadabada{[ <\yada> <\bada> ]}
\pdfvariable trailerid {\yadabada} % Preceding with \expandafter does not help.
\begin{document}
foo
\end{document}
Inspection of the PDF in a plain text editor, shows that the Info /ID is literally \yadabada
rather than the expanded pair of hex strings. The most obvious attempt to fix this, is to precede \pdfvariable
with \expandafter
, but that has no effect.
What to do, if anything can be done?
Note that I am not using (and cannot use, in this workflow) \DocumentMetadata
.
\pdfvariable
with\expandafter
will just expand thet
, as far as I know. I'm not sure if that is what you tried or you meant something else?\newcommand{\pdfvartrailerid}[1]{\pdfvariable trailerid{#1}}
then use\ExpandArgs{o}\pdfvartrailerid{\yadabada}
(or\ExpandArgs{e}
)\Expandargs{e}
call.