[cairo] Attaching document metadata to surfaces
michael at no-surprises.co.uk
Tue Mar 2 07:33:23 PST 2010
I've been investigating adding metadata such as author information and
document titles to PDF surfaces recently. As such, I've been looking
into the XMP standard, which defines a way of embedding XML-serialized
RDF into PDFs (and other file types too). I was going to propose and
implement a new API call to allow users to attach this metadata to a
surface, but on IRC sanooj pointed me at the work that has been done to
support adding images using URLs to SVG documents.
I'd therefore like to propose an extension to this function, which will
add another MIME type that can be used to attach an arbitrary XML string
to a surface, which can then be written out at the correct stage of the
output generation. For PDF documents it would most likely wrap it inside
an <xmpmeta> element, and for SVG inside a <metadata>. (Apparently it
may also be applicable to PostScript and perhaps SVG, though I'm not
sure yet how this would work.) Beyond the root element, I don't expect
Cairo to know anything at all about the XML that is passed in - it will
be up to the user to get it correct.
My questions are therefore:
1) Does this sound reasonable?
2) Does anyone have a preference for a MIME type? I considered just
application/rdf+xml, but I'm not sure if that would be a good idea.
If nobody has any complaints, I'll work on a patch.
More information about the cairo