# How to change the PDF producer metadata with XeLaTeX on MikTeX

I tried to change the PDF Producer of the generated PDF file with XeLaTeX, but it always be "MikTeX-xdvipdfmx (0.7.8)", if the PDF is generated with pdflatex, it will change as I wish, does anybody know how to change it with xelatex? I'm using MikTeX2.9.

\documentclass{article}
\usepackage[pdfproducer={xelatex}]{hyperref}
\begin{document}
hello
\end{document}

-
As far as I know you can't. hyperref already tries to change it but xetex overwrites this changes. – Ulrike Fischer Apr 23 '11 at 9:45
@Ulrike: it doesn't make any difference, but it's xdvipdfmx. It happens also on Mac OS X, even with xdv2pdf (the producer is Mac OS X 10.6.6 Quartz PDFContext). The xdv file contains the requested "Producer" field. – egreg Jun 8 '11 at 14:53
@egreg: Please turn Ulrike's and your comments into an answer. – lockstep Jun 23 '11 at 15:36

The xdvipdfmx program that post processes the xdv file produced by XeTeX into a PDF defines a "Producer" string on its own, overwriting the one defined in the document.

There's apparently no way to change this behavior, which happens also with the (obsolete) postprocessor xdv2pdf available on Mac OS X.

If one compiles with XeTeX without calling xdvipdfmx, the requested "Producer" string is found in the xdv file. Indeed the call

xelatex -no-pdf test.tex && strings test.xdv | grep Producer


(where test.tex is the example file in the question) prints

pdf:docinfo<</Title()/Subject()/Creator(LaTeX with hyperref package)/Author()/Producer(\376\377\000x\000e\000l\000a\000t\000e\000x)/Keywords()>>

-

As pointed out correctly by egreg, xdvipdfmx overrides any producer you try to set in the PDF metadata with its own xdvipdfmx (<version number>). However, you can include so-called XMP metadata information in addition to the normal metadata catalog in a PDF document. This offers you the possibility of setting the <pdf:Producer>, which is displayed in Adobe Reader instead of the normal /Producer field if present.

Currently, XMP data can be added to a LaTeX document using one of the packages xmpincl or hyperxmp. While the former is more flexible, it requires you to create an .xmp file yourself. Furthermore, as it only works with pdfTeX, it won't work for your configuration.

So in your case, I would recommend using the hyperxmp package: It takes care of generating the necessary stucture automatically, and it works with a number of TeX engines. As it uses the pdfauthor, pdfproducer, ... fields set with hyperref, simply loading it with \usepackage{hyperxmp} is enough to generate the XMP metadata:

\documentclass{article}
\usepackage{hyperref}
\usepackage{hyperxmp}
\hypersetup{pdfproducer={xelatex}}
\begin{document}
hello
\end{document}


### Result:

If you're using XeLaTeX in combination with the memoir class, the question Is there a poisonous interaction between Memoir, Hyperref, and HyperXmp might be of interest to you.

However, keep in mind that this only works for XMP-aware programs, other programs will still display xdvipdfmx (<version number>). Furthermore, xdvipdfmx compresses all PDF objects including the XMP metadata, which is fine for Adobe, but may confuse other programs (see the hyperxmp manual for more information).

-