[cairo] Attaching document metadata to surfaces

Ian Britten britten at caris.com
Fri Mar 19 08:59:59 PDT 2010


Michael Maclean wrote:

> I've been investigating adding metadata such as author information and
> document titles to PDF surfaces recently.

+1

Woo-hoo!  I'm sure I (or, my users) will be looking for this in the
future, and am thus happy to hear this, and hope it works out!
Unfortunately, I know nothing about how to do this, and can't offer
much input on your proposal...

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

Does this mean that if I wanted to set a "Title" on an abstract
Cairo surface, I'd have to know the actual surface type, and format
the input (XML?) accordingly?  Or is that handled by the implementation
and I could just do something like:
   cairo_set_metadata(surface, "Title", "My Document");
and the surface would deal with formatting it as necessary?



BTW - Somewhat offtopic (But PDF related):
A while ago, I asked about adding layers to PDF files (See
http://lists.cairographics.org/archives/cairo/2009-December/018705.html)
Although I suspect not, is their any chance your enhancement would
be able to be used to achieve this, or even work toward it?  I suspect
not, but I figured I'd ask ...

Ian


More information about the cairo mailing list