29

The Last(?) Word

I have now accepted @MatthewLeingang's answer. This directs me to the hyperxmp package, which appears to be the simplest solution (for me as a very-end user). The fact that this doesn't work in my  workflow and environment isn't Matthew's fault.

To chase the rest of my problem, which appears to involve a conflict with memoir, readers may be interested in this spin-off question.

Thank you all again for your help.


Progress Update 1:

First, flouting convention, my sincere thanks to all who have answered or commented (duly upvoted). Special thanks to @diabonas, whose sample PDF does indeed contain a copyright notice.

However, there may be a clue here: while his PDF says this:

PDF Producer: XeTeX 0.9997

mine says this:

PDF Producer: xdvipdfmx (0.7.8)

Now, I'm processing it with XeLaTeX via latexmk, but to keep myself honest, I re-did it with just XeLaTeX, with the same result.


Progress Update 2:

Here's an MWE that fails, and gives "PDF Producer: xdvipdfmx (0.7.8)":

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass{memoir}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{hyperxmp}
\hypersetup{
    pdfauthor={Brent Longborough},
    pdftitle={O Hai},
    pdfcopyright=Copyright © 2012 by Brent Longborough. All rights reserved.}
\begin{document}
\lipsum[1]
\end{document}

By just changing the document class to article, we get "PDF Producer: XeTeX 0.9997", and the copyright notice appears!


Original Question:

Using XeLaTeX. I want to add two pieces of metadata to a PDF: copyrighted status and the copyright notice.

I'm already using hyperref in the document, and I have no special worries about "overheads", only about keeping the workflow simple.

On the principle of "monkey see, monkey do", I tried this to no avail:

\hypersetup{%
    pdfinfo={%
        CopyrightStatus={Copyrighted},
        CopyrightNotice={Copyright © 2012 by Brent Longborough}
        }
    }

So far, I have been unable to find the correct tag names, or to discover even whether I have a chance.

All suggestions are welcome, but I'd especially like a pointer to the book of tag names for PDF metadata.


The answers and comments from Martin and EGreg deserve some additional explanation on my part.

My PDF reader is PDF Xchange Viewer from Tracker Software. When I view the Document Properties, and select the "Additional Metadata..." button, a [third] window appears in which there appear a dropdown labelled "Copyright Status:", with options "Unknown", "Copyrighted", and "Public Domain"; and a text box labelled "Copyright Notice:":

screenshot of PDF Xchange Viewer's windows

So you can see the source of my half-blind groping for metadata tags...

So, I guess what I'm really asking is "What tag names should I be using to fill in these fields?"


After hacking at the PDF (using @egreg's tip and then the viewer itself), I found the Copyright stuff in some RDF dc: namespace. I have since tried using the hyperxmp package, but without success (nothing shows up in the PDF), and I suspect that may be because it only works for pdfLaTeX.


I have also tried @MatthewLeingang's answer, but can confirm that it definitely requires pdfLaTeX, and I really don't want to go back.

4
  • 2
    xdvipdfmx adds the info to the PDF dictionary; you can see it if you call xelatex -output-driver="xdvipdfmx -z 0" file, which sets compression level to 0, and then look at the PDF file. How to use this information is perhaps beyond the scope of this site.
    – egreg
    Commented Jan 18, 2012 at 11:40
  • You'll have to ask Tracker Software for information on what to add to the PDF. Commented Jan 18, 2012 at 13:41
  • @doncherry: Thanks for the image; sorry I was too lazy. Commented Jan 18, 2012 at 14:21
  • 1
    @Brent.Longborough: You're welcome. If Wikipedia's down already, we have to live up to our wikiness :)
    – doncherry
    Commented Jan 18, 2012 at 14:58

4 Answers 4

25

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

  1. Make sure you have the xmpincl package. It's in TeX-live.

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

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

enter image description here

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.

13
  • 2
    Matthew, I'm really grateful for the effort you've put into your answer, and I've +1ed it. However, unfortunately, as you point out, xmpincl doesn't support XeLaTeX. As I'm happier to give up the metadata before I give up XeTeX, no deal, I'm afraid; please don't think me ungrateful... Commented Jan 18, 2012 at 14:46
  • 1
    @Brent.Longborough: no problem. After I realized it wouldn't work for you under your current workflow I decided to submit anyway in case others found it useful. Commented Jan 18, 2012 at 15:13
  • 1
    Since version 1.2, hyperxmp should be compatible with XeTeX/xdvipdfmx, thus solving @Brent.Longborough's problem.
    – diabonas
    Commented Feb 25, 2012 at 11:12
  • 1
    @Brent.Longborough That's weird... I tested the above MWE with an up-to-date TeX Live 2011 installation (Windows), and viewed the resulting file with PDF-XChange Viewer 2.5, which displayed the copyright information. This is the generated PDF file: hyperxmp-copyright.pdf. Does this work for you?
    – diabonas
    Commented Feb 27, 2012 at 18:41
  • 2
    As far as I know xdvipdfmx always declares itself as producer, overriding whatever is in the source file.
    – egreg
    Commented Feb 27, 2012 at 21:43
11

The main reference should be the "PDF Reference book", fourth edition, that on page 714 lists the known entry types for the document information dictionary:

Title, Author, Subject, Keywords, Creator, Producer, CreationDate, ModDate, Trapped

On page 713 it says

Note: Although viewer applications can store custom metadata in the document information dictionary, it is inappropriate to store private content or structural information there; such information should be stored in the document catalog instead (see Section 3.6.1, “Document Catalog”).

However, on page 882 (Appendix E), it says

Note: New keys for the document information dictionary (see Section 10.2.1, “Document Information Dictionary”) or a thread information dictionary (in the I entry of a thread dictionary; see Section 8.3.2, “Articles”) need not be registered.

Not the expected answer, I guess. PDF viewers won't know how to access the information, if they are not programmed to.

EDIT

With Adobe Reader X your keys are recognized:

enter image description here

4
  • Cool. The disadvantage of this approach is that a machine does not know what these keywords mean. XMP uses RDF, a data-description framework with namespaces. So when one agent says something about a resource using, for instance, Dublin Core metadata, other agents can begin to understand it. But I am known to go off on massive metadata tangents... Commented Jan 18, 2012 at 22:30
  • I agree, but adding XMP support to (x)dvipdfmx seems not to be an easy task, considering the scantiness of the documentation.
    – egreg
    Commented Jan 18, 2012 at 22:37
  • 1
    maybe not. xmpincl.sty is 100 lines long and boils down to these commands: \pdfcompresslevel=0\immediate\pdfobj stream attr {/Type /Metadata /Subtype /XML} file{#1.xmpi} \pdfcatalog{/Metadata \the\pdflastobj\space 0 R}. So it's only a few things to translate to \specials, IIUC. Commented Jan 19, 2012 at 1:45
  • There's some discussion of this, which seems to suggest how one would add PDF objects to XeTeX, at tug.org/pipermail/xetex/2011-August.txt (search for "analogues of \pdfobj?") Commented Jul 16, 2012 at 17:49
4

Your code will work (as egreg points out) and write the keys and their values to the PDF info dict, but I don't know of any standardised keys for this information. You'll probably have better luck with XMP (sorry, Wikipedia is blacked out because of SOPA). There isn't much support for XMP with LaTeX, though.

7
  • 2
    There is a latex package for including XMP metadata. Is XMPP the same as XMP? Commented Jan 18, 2012 at 13:01
  • No, XMP is correct, while XMPP is the protocol used by jabber/googletalk etc. The pagetitle is still visible on @Martin's wikipedia link. ;-) Commented Jan 18, 2012 at 13:13
  • @MatthewLeingang: Yeah. It's mostly from 2005 and works somewhat. Commented Jan 18, 2012 at 13:46
  • 2
    There is another package ctan.org/pkg/hyperxmp
    – matth
    Commented Jan 18, 2012 at 13:55
  • 2
    @Brent.Longborough The manual of hyperxmp says that with XeTeX one needs to disable compression (with the -z 0 trick I mentioned before).
    – egreg
    Commented Jan 18, 2012 at 22:42
2

If you have Perl available and the CPAN module Image::ExifTool installed, you can use

exiftool -@ copyright.txt pdffile.pdf`

where copyright.txt contains something like

-d
%Y
-copyright<Copyright ©$createdate, Brent Longborough

to create a dated copyright entry.

The advantages of this approach are that it can be easily automated and the copyright year is created automatically. Apart from the need to install the tool, the disadvantages are one more file to be maintained (but probably in a shared location) and one extra step when doing things manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .