TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I know one of hyperref's features is that it can add metadata to you PDFs. This is a nice feature and if you're putting stuff online, it's good to include metadata.

But is the hyperref package really the best way to do it? I mean, if you're using hyperref anyway, that's fine. But if you don't want hyperrefs in your document, it seems weird to include the package, and then turn off pretty much all its functionality. And given that hyperref is a shorthand for "package conflict nightmare", is seems insane that you should have to deal with it just for the sake of some metadata.

So I have two questions.

  1. Is there a good reason that hyperref includes this functionality which is apparently unrelated to its primary purpose?
  2. Is there a better (smaller, less conflicty, easier...) option to include metadata in my PDFs?
share|improve this question
up vote 46 down vote accepted

You could use the \pdfinfo command of pdfTeX to add meta data. For example:

  /Title (example.pdf)
  /Creator (TeX)
  /Producer (pdfTeX 1.40.0)
  /Author (Seamus)
  /Subject (Example)
  /Keywords (pdflatex, latex,pdftex,tex)}

There's no need to load a package for that purpose. This command is explained in the pdfTeX documentation.

share|improve this answer
Holy cow: \usepackage{titling} \title{Foo} \pdfinfo{/Title (\thetitle)} WORKS! I was not expecting that... – Seamus Nov 26 '10 at 12:00
This doesn't seem to work if hyperref is used. Not a big deal but slightly annoying since it means I have to move the information if I want to add or remove hyperref at some point. It also means that if I have included hyperref in a file common to several documents, I can't set the title separately for each. – Max May 28 '12 at 8:41
It works for me when I use \AtBeginDocument, as in tex.stackexchange.com/a/304758 – Nathan Musoke Jun 2 at 10:34

There is xmpincl which allows you to add arbitrary metadata in the Adobe XMP (Extensible Metadata Platform) format. But you have to write a separate XML file to do this. I always thought there should be a LaTeX way to create an XMP file on the first pass and embed it in the PDF on the second pass. But so far I know of none.

share|improve this answer
Make use of the filecontents package and the filecontents* environment (yes, with star). – Speravir Nov 1 '13 at 0:51
@Speravir: filecontents would allow me to write text to a file verbatim, true. I'm thinking more of a process that would dynamically generate the XMP file. Since I made the original comment, I have learned that the attachfile and attachfile2 packages can be used for the embedding part of the task. – Matthew Leingang Nov 1 '13 at 15:29

Just an update - this package by Scott Pakin may help (release date January 2, 2014 ) ...

hyperxmp – Embed XMP metadata within a LATEX document


" ... The pack­age in­te­grates seam­lessly with hy­per­ref and re­quires vir­tu­ally no mod­i­fi­ca­tions to doc­u­ments that al­ready ex­ploit hy­per­ref's mech­a­nisms for spec­i­fy­ing PDF meta­data..

"XMP (eXten­si­ble Me­ta­data Plat­form) is a mech­a­nism pro­posed by Adobe for em­bed­ding doc­u­ment meta­data within the doc­u­ment it­self. The meta­data is de­signed to be easy to ex­tract, even by pro­grams that are obliv­i­ous to the doc­u­ment's file for­mat. Most of Adobe's ap­pli­ca­tions store XMP meta­data when sav­ing files. Now, with the hy­per­xmp pack­age, it is triv­ial for LATEX doc­u­ment au­thors to store XMP meta­data in their doc­u­ments as well


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.