6

I got the hyperxmp package to include XMP copyright information with regular LaTeX but with XeLaTeX there seems to be a problem. I need XeLaTeX for its better font support and typographic features. Is there any way to get hyperxmp working with XeLateX?

Here's a stripped-down version of the hyperxmp package documentation example:

\documentclass{article}

\usepackage{hyperxmp}
\usepackage{hyperref}

\title{Paper}
\author{Nomen Nescio}

\hypersetup{
pdfcopyright={Copyright © Nomen Nescio. Creative Commons 3.0 Attribution License.}
pdflicenseurl={http://creativecommons.org/licenses/by/3.0/us/}
}

\begin{document}

\maketitle

processes in so-called empty space\dots

\end{document}

XeLaTeX gives this:

** WARNING ** Could not find an object definition for "hyxmp@Metadata".
** WARNING ** Interpreting special command object (pdf:) failed.
** WARNING ** >> at page="1" position="(133.768, 524.256)" (in PDF)
** WARNING ** >> xxx "pdf: object @hyxmp@Metadata << /Type /Metadata /Subtype /XML..."
** WARNING ** >> Reading special command stopped around >>stream\x0a<?xpacket begin="\xc3\xaf\xc2\xbb\xc2\xbf" id="W5M...<<
** WARNING ** Unresolved object reference "hyxmp@Metadata" found!!!

When I open the file and look at the properties, there is no copyright information. I have tried with another file that has them and it shows its copyright information.

  • I have moved your answer from the question to the answer space. Feel free to post your own answer containing the same information: I will then delete the 'community wiki' one I have created. – Joseph Wright Aug 11 '12 at 8:41
6

You file runs fine with me. I get the copyright information correctly.

Just to show the xetex version (XeTeX: 0.9997)

enter image description here

You have to click the Additional Metadata... button in the above window (picture). The copyright information which I get

enter image description here

Note: It seems that you may have to update your packages.

  • Thank you for trying it out. This clears the issue, I should have thought about it. It seems that many distros have pretty old versions of XeTeX (I tried Ubuntu and Fedora). Nice to know that it will work in the future. – Tuomo Sipola Mar 23 '12 at 14:10
0

[Questioner's own answer, moved from a question-edit to here]

Finally! I found out a way to circumvent this. This message by Pablo Rodríguez gives the answer.

There must be both pdfcopyright and pdflicenseurl, otherwise it will not work.

Here is the code for the preamble:

\makeatletter
\renewcommand*{\hyxmp@embed@packet@dvipdfm}{%
\ifxetex{%
  \hyxmp@string@len{\hyxmp@xml}%
  \special{pdf:stream @hyxmp@Metadata (\hyxmp@xml)
    <<
      /Type /Metadata
      /Subtype /XML
    >>
  }%
  \special{pdf:put @catalog
    <<
      /Metadata @hyxmp@Metadata
    >>
  }%
}
\else
\hyxmp@string@len{\hyxmp@xml}%
  \special{pdf: object @hyxmp@Metadata
    <<
      /Type /Metadata
      /Subtype /XML
      /Length \the\@tempcnta
    >>
    stream^^J\hyxmp@xml endstream%
  }%
  \special{pdf: docview
    <<
      /Metadata @hyxmp@Metadata
    >>
  }%
\fi
}
\makeatother

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.