3

I use pdfx to generate the metadata of my document. Is there a way to generate more entries via the xmpdata file?

Entries I consider as relevant (as required for bibliography) are e.g. subtitle, institution for tech reports or school for theses.

\documentclass{scrbook}
\usepackage[a-2u]{pdfx}

\begin{filecontents}{test_pdfx.xmpdata}
\Title{Test PDF/A-2u standard}
\Subtitle{This subtitle is not added to the document}
\Author{Me T. Author}
\end{filecontents}

\begin{document}

Tested PDF/A-2u.

\end{document}

More bibliographic entries can be found at Wikibooks.

Applications

While reading the manual of pdfx, I did not really understand what the /Info part of the meta data is used for. Where would I see an effect if I include \sep in title, authors or keywords?

  • Maybe hyperxmp package is what you are looking for. – Ross Jun 11 at 10:47
  • For me it is important to generate a long-living PDF/A as output, so are they compatible. There is no word about incompatibility between pdfx and hyperxmp. If not Marijin's answer is irrelevant. – strpeter Jun 11 at 12:38
  • @strpeter pdfx and hyperxmp are incompatible, but hyperxmp can also generate PDF/A (as shown in my answer). Also, just one i (as in Marijn), I don't mind the mistake but if you want me to be notified using @-mentions then you should spell the name correctly :) see also meta.stackexchange.com/questions/43019/…. – Marijn Jun 11 at 14:12
3

There are two types of metadata: The entries in the info dictionary and the xmp-metadata.

Info dictionary

hyperref allows to add more entries to the info dictionary:

\documentclass{scrbook}
\pdfcompresslevel=0
\usepackage{hyperref}
\hypersetup{pdfinfo={Subtitle=some subtitle}}
\begin{document}
Tested
\end{document}

This entry can then be seen in the pdf properties:

enter image description here But pdfx redefines an internal hyperref command and destroys such add-ons.

xmp-metadata

xmp-metadata can be added with pdfx and hyperxmp, (the packages are incompatible, so you will have to choose). pdfx doesn't know a Subtitle-metadata and as far as I can see has also no interface to add new metadata. With hyperxmp you can add a subtitle-metadata, but as hyperxmp like pdfx overwrites an internal hyperref command this destroys the entry in the info dictionary too. If you want to keep this you will have to resort to low-level primitives, e.g. with pdftex

\pdfinfo{/Subtitle (text)}

text must be a valid pdf-string or you must pass it through \pdfstringdef.

1

As noted in the comments, you can use the hyperxmp package. This allows for an extensive set of additional metadata fields to be entered, among which a subtitle field and various bibliographical information fields. Note that the extra information is not visible by default in the document properties dialog, it can be viewed using the Additional Metadata... button in Acrobat Pro.

MWE:

\documentclass{article}
%\usepackage[a-2u]{pdfx}
\usepackage[pdfa]{hyperref}
\usepackage{hyperxmp}

\hypersetup{
pdftitle={Test PDF/A-2u standard},
pdfauthor={Me T. Author},
pdfsubtitle={Subtitle of the document},
pdfpubtype={Technical Report},
pdfpublisher={Scientific Institution of Tech Reports},
pdfapart={2},
pdfaconformance={U},
keeppdfinfo
}

\begin{document}

Tested PDF/A-2u.

\end{document}

Result:

enter image description here

Note that the pdfx package is not used. The pdf/a-2u conformance is set by a combination of the pdfa option to hyperref and the pdfapart and pdfaconformance fields of hyperxmp. Note also that the keeppdfinfo option is specified, if this is not there then no metadata is shown at all in viewers other than Adobe Reader/Acrobat. With this option only the standard info is shown in other viewers (Evince, pdfinfo in the terminal, etc), not the additional metadata fields.

If you want to add a custom field that is not predefined by hyperxmp then you could use the xmpincl package. The manual of hyperxmp notes:

hyperxmp and xmpincl can complement each other. An author may want to use hyperxmp to produce a basic set of XMP code, then extract the XMP code from the pdf file with a text editor, augment the XMP code with any metadata not supported by hyperxmp, and use xmpincl to include the modified XMP code in the pdf file.

  • Your example does not compile in my machine. It said that the keys from the package are undefined... I know I installed texlive-core, where the package is included. Eventually I need a newer version than 2018/11/27? For me it is important to generate a PDF/A as output, so I hope they are compatible. – strpeter Jun 11 at 12:32
  • Yes, there is a newer version (2019-04-07, see ctan.org/pkg/hyperxmp) which has more keys. Installation is simple: go to Sources and download hyperxmp.dtx and hyperxmp.ins, then run latex hyperxmp.ins (note: regular latex, not pdflatex). Then a hyperxmp.sty file is generated. If you place it in the same folder as your .tex file (or in your texmf tree to make it globally available) then LaTeX will use the new version instead of the system-installed version. – Marijn Jun 11 at 13:13

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.