Closed miticollo closed 2 weeks ago
Strictly speaken you do not need hyperref to add these metadata. You can e.g. use the title-module in the latex-lab bundle:
\DocumentMetadata{
pdfstandard=A-2b,
testphase={title},
}
\documentclass{book}
\title[pdftitle=pdf/A-2b Standard]{A longer title}
\author{Ulrike Fischer}
\begin{document}
abc
\end{document}
And yes the plan is to add keys to \DocumentMetadata
that can be used in a similar way. The main problem is to come up with a good set of keys and key names ...
Thank Ulrike for your answer!
I tried a more complicated example:
\DocumentMetadata{
pdfstandard=A-3b,
lang={it-IT,en-US},
}
\documentclass{toptesi}
\usepackage[verbose]{hyperref}
\hypersetup{
pdfmetalang = {it-IT,en-US},
pdftitle = {Da iOS stock ad AnForA},
pdfauthor = {Lorenzo Ferron},
pdfsubject = {Da iOS stock ad AnForA},
pdfkeywords = {Master's Degree, italian, iOS, AnForA},
pdfsubtitle = {Studio di fattibilità con metodo bottom-up e realizzazione di un PoC di AnForA in ambito iOS},
pdfcaptionwriter = {Lorenzo Ferron},
pdfcontactcity = {Alessandria},
pdfcontactcountry = {Italia},
pdfcontactemail = {john.doe@studenti.uniupo.it},
pdfcontactpostcode = {15122},
}
\AddToDocumentProperties[document]{copyright}{false}
\begin{document}
abc
\end{document}
I compiled it with
latexmk -interaction=nonstopmode -lualatex ./foo.tex
and I inspected XMP with
pdfinfo -meta ./foo.pdf
Everything works!
But at the moment it is not possible to remove \usepackage{hyperref}
, right? And in the future, when hyperref
is no more required the above code will be still compatible? I mean TeX files produced now will be compatible when a good set of keys and key names will be available?
But at the moment it is not possible to remove \usepackage{hyperref}, right?
Well you can, all the keys simply store they data into the DocumentProperties and from there the metadata code gets them. But the interface is not yet stable here - the names and the place where the data is store can (will probably) change. Beside this if you want to add stuff to the Info dictionary you must convert it into a PDF string, and this is easier if you have the hyperref tools available.
\DocumentMetadata{uncompress,
pdfstandard=A-3b,
lang={it-IT,en-US},
}
\documentclass{toptesi}
\AddToDocumentProperties[hyperref]{pdfauthor}{Lorenzo Ferror}
\AddToDocumentProperties[hyperref]{pdfcontactcity}{Alessandria}
\AddToDocumentProperties[document]{copyright}{false}
\ExplSyntaxOn
\pdfmanagement_add:nnn{Info}{Author}{(Lorenzo Ferror)}
\ExplSyntaxOff
\begin{document}
abc
\end{document}
And in the future, when hyperref is no more required the above code will be still compatible?
Yes. But if you use \hypersetup
you will have to load hyperref.
Thank Ulrike to have answered my questions! Now I know that \DefaultMetadata
+ \hypersetup
will be safe in future. I think that I can switch from pdfx
to \DefaultMetadata
. So I can switch from PDF/A-3b to PDF/A-3a + PDF/UA-1 for my master degree thesis.
Yesterday, I discovered
\DocumentMetadata
and I started to look around to understand how to switch frompdfx
to\DocumentMetadata
. This decision was also motivated by this comment.Searching on Google, I discovered that
\DocumentMetadata
was introduced with the 2022-06-01 LaTeX kernel update. Then I read this publication because IMO it clear explains why\DocumentMetadata
is introduced starting with an overview on previous packages, aspdfx
that I knew.I understood that
\DocumentMetadata
is a kernel command but at the moment the PDF management is in testphase. For this reason, the only way to add some Metadata is to use\hypersetup
like reported here:But the thing that amazed me was
hyperref-generic
module. Always in the previous publication is reported: Furthermore,l3pdfmeta
reports: https://github.com/latex3/pdfresources/blob/959db881f48fa1070af7d122f42074f337b0ee31/l3pdfmeta.dtx#L395-L396 Based onhyperref-generic
doc, it seems that this is not a temporary module: https://github.com/latex3/pdfresources/blob/959db881f48fa1070af7d122f42074f337b0ee31/hyperref-generic.dtx#L91-L92 If I'm not wrong, this generic driver requiredhyperref
. But in this wayhyperref
is always required?To be more clear, what I would expect is the following. During testphase you must load
hyperref
When the PDF management will be merged into
l3kernel
(likel3pdf
),hyperref
is no more strictly necessary to add Metadata to PDF:Example taken from this answer.