Take the 2-minute tour ×
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.

Is it possible to create custom metadata key/values for a PDF file?

I can see (from other questions here) how to add title, author, keywords etc. However, I'm creating transcriptions of historical documents and I'd like to add some additional metadata, such as the record office holding the document and the document accession number.

The idea is that (in the future) when I want to make them available on the web I can write an app that can read the PDF to extract the metadata (via something like PDFBox or iText) to include it in a HTTP POST.

share|improve this question
2  
an article by ross moore in tugboat: Advanced features for publishing mathematics, in PDF and on the Web discusses metadata other than just the main bibliographic information for a document. –  barbara beeton Feb 18 at 15:48
add comment

3 Answers 3

up vote 11 down vote accepted

Package hyperref

Package hyperref supports the setting of arbitrary keys in the PDF information dictionary (see manual):

\documentclass{article}
\usepackage{hyperref}

\hypersetup{
  pdfinfo={
    RecordOffice={my office},
    AccessionNumber={42},
  }
}

\begin{document}
Hello World.
\end{document}

However, these keys are not standardized, thus most tools will not show them. But you can extract them via a PDF library.

Package hyperxmp

The PDF format also supports XMP (eXtensible Metadata Platform). More keywords are standardized there. See package hyperxmp of Scott Pakin.

share|improve this answer
    
That's great. I can add the metadata and query via Apache PDFBox. –  MikeJ Feb 18 at 16:50
add comment

There is also pdfx package. Here you have to add metadata as a separate .xmp file.

\documentclass{article}

\usepackage{lipsum}
\usepackage[a-1b]{pdfx}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.xmpdata}
\Keywords{pdfTeX\sep PDF/X-1a\sep PDF/A-b} 
\Title{Sample LaTeX input file} 
\Author{LaTeX project team} 
\Org{TeX Users Group}
\Doi{123456789} 
\end{filecontents*}
\begin{document}
\lipsum

\end{document}
share|improve this answer
add comment

I'm using hyperref package ...that is much more limited in features compared to your requirements.

share|improve this answer
2  
Welcome to TeX.SX! Could you enhance your answer, for instance by providing some examples? –  Claudio Fiandrino Feb 18 at 15:48
add comment

Your Answer

 
discard

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.