How can I generate PDF metadata from LaTeX?

Use the hyperref package, included in pretty much every latex distribution these days.

\usepackage[pdftex,
            pdfauthor={Your Name},
            pdftitle={The Title},
            pdfsubject={The Subject},
            pdfkeywords={Some Keywords},
            pdfproducer={Latex with hyperref, or other system},
            pdfcreator={pdflatex, or other tool}]{hyperref}

Use the \pdfinfo macro, where the contents are given in PDF notation:

\pdfinfo{
   /Author (Nicola Talbot)
   /Title  (Creating a PDF document using PDFLaTeX)
   /CreationDate (D:20040502195600)
   /Subject (PDFLaTeX)
   /Keywords (PDF;LaTeX)
}

(Source: http://theoval.cmp.uea.ac.uk/~nlct/latex/pdfdoc/pdfdoc/pdfdoc.html)


As others have already answered, I like to use hyperref. However, as my documents often have \author and \title commands I do not want to repeat myself in the package parameters. Luckily, hyperref also has a parameter for that. If you want it to read the information from your \author and similar tags, simply include it like this:

\usepackage[pdfusetitle]{hyperref}