4

I'm trying to generate a PDF/A using pdflatex and pdfx and want the PDF meta data populated with the values I specify in the .xmpdata file.

My problem is, that the author and keyword information is not written into the PDF meta data, while this works just fine for title and subject.

Here's a MWE to demonstrate my problem, pretty similar to what the pdfx documentation shows.

\begin{filecontents*}{\jobname.xmpdata}
\Title{Baking through the ages}
\Author{A. Baker}
\Keywords{cookies\sep muffins\sep cakes}
\Publisher{Baking International}
\Subject{The Subject}
\end{filecontents*}

\documentclass{scrartcl}
\usepackage[a-1b]{pdfx}

\begin{document}
First line

\makeatletter
Author: \pdfx@Author

Keywords: \pdfx@Keywords

Subject: \pdfx@Subject

Title: \pdfx@Title
\makeatother

last line.
\end{document}

If you check the PDF properties, the lines for author and keywords are empty, which I find not very intuitive, given that subject and title is filled. This might be related to the use of \sep in the author and keyword fields, but it does not make a difference if you actually use it or not (see MWE).

I'm using an up-to-date Manjaro Linux with texlive. My PDF viewer is evince.

I found the following workaround, which is probably horribly hacky, but works for me:

\makeatletter
\def\sep{; }
\pdfx@topdfstring\pdfx@Author\xmp@Author
\pdfx@topdfstring\pdfx@Keywords\xmp@Keywords
\makeatother

When I insert this before \begin{document}, the behaviour is as expected and all fields are filled.

Alternatively I could specify the same things again using \pdfinfo{...}, but I don't understand why I would need to do this again.

Maybe someone can explain what is going on or if this is a bug in pdfx. Thanks.

3
  • I have the same error, and I can confirm that the workaround is working. Thanks for that :) (Using texlive 2017 under ubuntu)
    – Luis
    Aug 13, 2018 at 20:10
  • With your MWE processed by TeX Live 2018 (Ubuntu 18.04) as well as MikTeX 2.9 (Windows), Evince shows no entries for the fields complained about, but Adobe Acrobat Reader does.
    – sdm4n
    Sep 17, 2018 at 15:15
  • You can also download the xmp and parse all the info in it PDF Nav pdfnav.com
    – Arnav
    Nov 16, 2021 at 5:37

1 Answer 1

5

I recommend the following way without pdfx to get your MWE working:

%\pdfobjcompresslevel=0 %uncomment for Texlive
\documentclass{scrartcl}

\usepackage{hyperxmp}
\usepackage[pdfa]{hyperref}
\usepackage{mmap} %only needed for pdfTeX

\title{Baking through the ages}
\subtitle{The Subject}
\author{A. Baker, A. Companion}
\newcommand\stichworte{cookies,muffins,cakes}

\hypersetup{%
    pdfapart=1,
    pdfaconformance=b,
    pdfkeywords={\stichworte},
    pdfpublisher={Baking International}
}

\immediate\pdfobj stream attr{/N 3} file{sRGB.icc}
\pdfcatalog{%
  /OutputIntents [
    <<
      /Type /OutputIntent
      /S /GTS_PDFA1
      /DestOutputProfile \the\pdflastobj\space 0 R
      /OutputConditionIdentifier (sRGB)
      /Info (sRGB)
    >>
  ]
}

\begin{document}

First line

\makeatletter
Author: \@author

Keywords: \stichworte

Subject: \@subtitle

Title: \@title
\makeatother

last line.
\end{document}

I can't speak for pdfx but reusing variables can break things also with other packages. Thus it's better to create a new command for those entries that don't belong to the title page as done with \stichworte in this MWE.

5
  • Note, the documentation for hyperxmp explicitly says to load it before hyperref.
    – Noldorin
    Jan 15, 2021 at 4:40
  • fixed. It makes only a difference in rare cases.
    – tanGIS
    Jan 16, 2021 at 18:38
  • Yep, I'm sure that's the case. Just thought I'd mention it anyway because it's in the docs. :-) BTW, for anyone curious, pass the keeppdfinfo option to hyperref to include the usual author and keywords metadata info. I wondered for a while why it was missing.
    – Noldorin
    Jan 16, 2021 at 18:56
  • No, normal users should not fiddle around with 'keeppdfinfo'. This writes a document info tag which is deprecated and superseded by 'XMP'. Just the first PDF/A-1 still requires it the newer versions don't. It's better not to write redundant information.
    – tanGIS
    Feb 2, 2021 at 12:33
  • Most PDF viewers seem to have problems getting these fields if you don’t used the doc info tag.
    – Noldorin
    Feb 2, 2021 at 14:40

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.