besides the printed book an e-book version is planned and the publisher requires certain XMP metadata to be set for it. More specifically Title
, Author
, Copyright-Status
, Copyright-Notice
and Copyright-URL
. For me personally I would like to store the git hash it was created from as well.
This is what I tried:
\documentclass{scrbook}
\immediate\write18{git log -1 --format="\@percentchar H " > currentVersionLong}
\usepackage{hyperxmp}
\usepackage{hyperref}
\hypersetup{%
pdftitle={The title},
pdfauthor={The author},
pdfcopyright={\textcopyright\ 2020 by the publisher},
% pdfversionid={\IfFileExists{currentVersionLong}{\input{currentVersionLong}}{No version information}},
pdflicenseurl={https://tex.stackexchange.com}
}
\begin{document}
Just an empty document
\end{document}
However there are two issues:
Shouldn't I see the data here, or do I need to inspect the PDF file uncompressed in Notepad++
?
- I want to read the current git has from the command line writing it to a file through
write18
. However the linepdfversionid={\IfFileExists{currentVersionLong}{\input{currentVersionLong}}{No version information}},
is not liked by hyperxmp. An idea how I can maybe read this into a macro first and then use it that way?