# 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
I opened a bug report at the XeTeX project. –  johntex Jun 18 at 2:47

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).

-

I also wanted to delete the annoying "xdvipdfmx (0.x.x)" and here is a solution for windows users (only TeX Live!):

Be careful you have to patch the executable, do it on your own risk and make an backup of the file first.

1. Get a Hex-Editor (I'm using the freeware CFF Explorer). Assuming your using it too, open the file xdvipdfmx.exe, go to "Hex Editor" and click on search symbol.

2. Than paste 786476697064666D78000000257320282573290050726F6475636572in Hex searchbox and click on find (this is equivalent to xdvipdfmx...%s (%s).Producer on the ASCII side).

3. If you want do delete the pdfproducer String fill with zeros like in the following image, i.e. do not remove the Hex string 50726F6475636572 (or in ASCII Producer):

4. Save the file in the proper directory (using texlive2013 it would be .../texlive/2013/bin/win32). Now you can compile your document using XeTeX.

5. On every update of this executable you will be forced to to this again.

Note: of course you've to use hyperref package for the other metasettings like pdfcreator.

-
Welcome to TeX.SX! –  Adam Liter Apr 2 at 15:44
A good Hex editor is the (Freeware Hex Editor XVI32). It has a builtin script interpreter, so the replacement task could be automated, what makes life easier when you have to repeat this some time in future. –  Speravir Apr 3 at 17:35
If you want to automate the process I wouldn't recommend using a Hex-Editor but using a search and replace patcher like dup2 or uPPP would be a good choice. –  Tim S. Apr 7 at 10:38