[cairo] PDF surface layers/OCG

Toby Collett thjc at plan9.net.nz
Tue Mar 22 09:32:44 PDT 2011


Hi all,
I need to be able to create layers/Optional Contents Groups (OCGs) in
a PDF that I am generating with Cairo. I have had a quick chat with
the helpful folk on the IRC channel and it seems like there have been
a few rounds of discussion on this previously.
My first thought was that layers were similar to pages and that
support could be provided in the cairo core. However there seems to be
some reluctance around this (which I understand, cairo is a rendering
library not a document layout engine).

The suggestions so far seem to be:
1) Resurrect some work done previously by Adrian on injecting PDF
objects into a stream (allowing an external library to manage the
layers, does the code for cpdf still exist?)
2) Create a new PDF surface external to cairo that handles the
advanced PDF features and hands off the rendering to the Cairo PDF
surface (does anything already exist that combines the two?)
3) Just post process the layers together, either converting multiple
documents to layers, or multiple pages to layers, this works for
simple layers, but becomes complex for multipage/multilayer documents.

Thoughts and pointers to previous discussions that I have missed would
be much appreciated,

Regards,
Toby


More information about the cairo mailing list