I'd like to generate a PDF/A-compliant document. Thus I need to embed the metadata using XMP but somehow the following MWE doesn't work.

\RequirePackage{pdf14}
\documentclass{article}

\usepackage[a-1b]{pdfx}
\newcommand{\Subject}[1]{\gdef\xmpSubject{#1}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.xmpdata}
\Subject{Foo}
\Title{My Sample Title}
\Author{Me}
\end{filecontents*}

\begin{document}
Foobar
\end{document}


How can I fix this and what's up with packages like hyperxmp?

• "does not work" is not an appropriate error message. What is the exact error you get? – user26372 Mar 22 '13 at 12:37
• Just move the \newcommand{\Subject}{...} line before \usepackage[a-1b]{pdfx} – egreg Mar 22 '13 at 12:47
• Well, there isn't any error but the PDF doesn't contain any metadata afterwards. Moving the subject line or leaving out the subject at all doesn't help either. – sdf Mar 22 '13 at 13:05
• Do you have ISOcoated_v2_300_bas.ICC in your computer somewhere? See : Add metadata in pdf as type pdf/a – user11232 Mar 22 '13 at 13:15