HowTo/XMP

XMP (Extensible Metadata Platform) provides a standard to work with metadata.

This page describes how to declare such metadata in an XSL-FO file.

/!\ This works only with FOP trunk.


Declaring properties in an XSL-FO file

All metadata properties can be declared in the fo:declarations element.

XMP specification recommends to use x:xmpmeta, rdf:RDF, and rdf:Description elements as shown in example below.

Only one of the 2 first is required to make PDF to recognize metadata properties.

Example

[..]
</fo:layout-master-set>
<fo:declarations>
        <x:xmpmeta xmlns:x="adobe:ns:meta/">
                <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
                        <rdf:Description rdf:about=""
                                xmlns:dc="http://purl.org/dc/elements/1.1/">
                                <!-- Dublin Core properties go here -->
                                <dc:title>Document title</dc:title>
                                <dc:creator>Document author</dc:creator>
                                <dc:subject>Document subject</dc:subject>
                        </rdf:Description>
                        <rdf:Description rdf:about=""
                                xmlns:xmp="http://ns.adobe.com/xap/1.0/">
                                <!-- XMP properties go here -->
                                <xmp:CreatorTool>Tool used to make the PDF</xmp:CreatorTool>
                        </rdf:Description>
                </rdf:RDF>
        </x:xmpmeta>
</fo:declarations>
<fo:page-sequence ...
[..]

<!> fo:declarations must be declared after fo:layout-master-set


Implementation in Apache FOP

Currently, XMP support is only available for PDF output.

Until recently, you could set some metadata information through FOP's FOUserAgent by using its set*() methods (like setTitle(String) or setAuthor(String). These values are directly used to set value in the PDF Info object. Since PDF 1.4, adding metadata as an XMP document to a PDF is possible. That means that there are now two mechanisms in PDF that hold metadata.

Apache FOP now synchronizes the Info and the Metadata object in PDF, i.e. when you set the title and the authort through the FOUserAgent, the two values will end up in the (old) Info object and in the new Metadata object as XMP content. If instead of FOUserAgent, you embed XMP metadata in the XSL-FO document (as shown above), the XMP metadata will be used as-is in the PDF Metadata object and some values from the XMP metadata will be copied to the Info object to maintain backwards-compatibility for PDF readers that don't support XMP metadata.

The mapping between the Info and the Metadata object used by Apache FOP comes from the [WWW] PDF/A-1 specification. For convenience, here's the mapping table:

Document information dictionary

XMP

Entry

PDF type

Property

XMP type

Category

Title

text string

dc:title

Text

External

Author

text string

dc:creator

seq Text

External

Subject

text string

dc:subject

Text

External

Keywords

text string

pdf:Keywords

Text

External

Creator

text string

xmp:CreatorTool

Text

External

Producer

text string

pdf:Producer

Text

Internal

CreationDate

date

xmp:CreationDate

Date

Internal

ModDate

date

xmp:ModifyDate

Date

Internal

Note: "Internal" in the Category column means that the user should not set this value. It is set by the application.

Properties sets

Metadata is made of properties sets.

Properties sets are:

Set

Namespace

URI

FOP support

Dublin core

dc

[WWW] http://purl.org/dc/elements/1.1/

Partial

XMP basic

xmp

[WWW] http://ns.adobe.com/xap/1.0/

Partial

XMP Rights Management

xmpRights

[WWW] http://ns.adobe.com/xap/1.0/rights/

None

XMP Media Management

xmpMM

[WWW] http://ns.adobe.com/xap/1.0/mm/

none

Adobe PDF Schema

pdf

[WWW] http://ns.adobe.com/pdf/1.3/

partial

Dublin Core set

Property

Comment

FOP support for PDF output

dc:creator

refers to author

Yes

dc:contributor

No

dc:coverage

No

dc:date

No

dc:description

No

dc:format

No

dc:identifier

No

dc:language

No

dc:publisher

No

dc:relation

No

dc:rights

No

dc:source

No

dc:subject

Yes

dc:title

Yes

dc:type

No

XMP basic set

Property

Comment

FOP support for PDF output

xmp:Advisory

No

xmp:BaseURL

No

xmp:CreateDate

Generate an error (1)

No

xmp:CreatorTool

Yes

xmp:Identifier

No

xmp:Label

No

xmp:MetadataDate

No

xmp:ModifyDate

Generate an error (1)

No

xmp:Nickname

No

xmp:Rating

No

xmp:Thumbnails

No

(1) These properties are "Internal" properties and must not be set my the user.


Links

.

last edited 2006-08-31 09:14:08 by JeremiasMaerki