As egreg notes, rights information is not part of the document information directory. But it can be included in the document's extensible metadata profile.
Here are two solutions that work with Adobe Acrobat and pdflatex
. I don't know if you will see the metadata in the same place as you do with Acrobat; PDF XChange Viewer is a Windows app and I have a Mac so I can't test it.
Also (potential showstopper, wish I had noticed this earlier) neither solutions works with xetex
. Perhaps they could be cajoled but that would require patching the package.
xmpincl
Make sure you have the xmpincl
package. It's in TeX-live.
Create a basic XMP file like this:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/">
<xmpRights:Marked>True</xmpRights:Marked>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:rights>
<rdf:Alt>
<rdf:li xml:lang="x-default">Copyright (C) 2012 by Brent Longborough. All rights reserved.</rdf:li>
</rdf:Alt>
</dc:rights>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
Let's call it copyright.xmp
. If you want to grant more rights you can; you just need something more detailed. Creative Commons has a page to help you generate an XMP file.
Include this license file in your document like this:
\documentclass{article}
\title{My article}
\author{Brent Longborough}
\usepackage{xmpincl}
\includexmp{copyright}
\usepackage{lipsum}
\begin{document}
\maketitle
\lipsum
\end{document}
That's it! When I open the document in Adobe Acrobat I can see the copyright information in the expected place. If I select File > Properties ... and click on "Additional Metadata..." it's there.
hyperxmp
The hyperxmp
implements extra document information keys pdfcopyright
and pdfcopyrighturl
that can be declared in much the same way as \pdfinfo
keys. Under the hood it creates the XMP file for you. So you only need a file like this:
\documentclass{article}
\title{My article}
\author{Brent Longborough}
\usepackage{hyperref}
\usepackage{hyperxmp}
\hypersetup{
pdfauthor={Brent Longborough},
pdfcopyright={Copyright (C) 2012 by Brent Longborough. All rights reserved.}
}
\usepackage{lipsum}
\begin{document}
\maketitle
\lipsum
\end{document}
Also doesn't work in xetex
, though.
If I understood you correctly, you want to have fields in your PDF document displaying the current author as stated in the file's metadata. Like this, you want to be able to update the document by changing the metadata with an external program, which is easier than manipulating the text directly.
Theoretically, this is possible using PDF forms and Acrobat JavaScript: The hyperref
package is capable of creating fillable forms, and with the insdljs
package, you are able to insert the code to update a field with the document information. (insdljs
is part of the AcroTeX bundle, which is in MiKTeX, but not in TeX Live, so you may have to install it manually.)
A proof of concept:
\documentclass{article}
\usepackage{hyperref}
\usepackage[pdftex]{insdljs}
\OpenAction{/S /JavaScript /JS (this.getField("fullname").value = this.info.author;)}
\hypersetup{pdfauthor={diabonas}}
\begin{document}
\begin{Form}
\TextField[name=fullname]{Name: }
\end{Form}
\end{document}
(pdfauthor
is set so that the form field displays something, you can change the PDF author with an external program to see that it works.)
Result:
However, this approach has two drawbacks:
- The inserted text looks quite different from the surrounding text.
- JavaScript doesn't work in many PDF readers other than Adobe (Reader), so unless you have this program installed and JavaScript activated, you'll get a blank field.
Drawback #1 can be tackled by using the various formatting options described in the hyperref
manual.
To overcome drawback #2, I would suggest a different approach than using the document's metadata to update the text:
Create a PDF document containing a fillable form (this is pretty much the same we already did, but without the JavaScript part):
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{Form}
\TextField[name=fullname]{Name: }
\end{Form}
\end{document}
Create a so-called FDF (Forms Data Format) file containing the information you want to insert into the PDF document. For our minimal example, the file would look like this (replace Firstname Lastname
with the name you want to insert):
%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF
<<
/Fields [
<<
/V (Firstname Lastname)
/T (fullname)
>>]
>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
To create a "template" FDF file you can fill yourself, you can use the PDF toolkit pdftk
:
pdftk form.pdf generate_fdf output form.fdf
Now, you can write the prepared FDF file form.fdf
into the original PDF form form.pdf
using pdftk
:
pdftk form.pdf fill_form form.fdf output form-filled.pdf flatten
This may seem more work than the first approach, but as a result, you get a static document that can be viewed by any PDF reader.
Best Answer
Package
hyperref
Package
hyperref
supports the setting of arbitrary keys in the PDF information dictionary (see manual):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.