How do I access PDF layers exported from Illustrator using PDFNet SDK?

Q: One of the things we would like to pullout of PDFs generated by
illustrator is the complete nested hierarchy of layers. In one use
case, I have created a 4-deep nested hierarchy of layers in
Illustrator CS3 and saved it out as a PDF (attached). When you open
this PDF file in Acrobat, you only have access to the top layer
(layer1) and cant see the hierarchy in the layer list. When you
reopen this in illustrator, the hierarchy is preserved and you can see
the nested layers - so the info is in there somewhere.

Is there a formal method using PDFNet SDK to access Illustrator's
nested layers?
-----
A: We looked into the sample PDF and indeed all content is located in
a single PDF layer. The content of this layer can be extracted as
shown in PDF Layers sample project (http://www.pdftron.com/net/
samplecode.html#PDFLayers).

In order to allow roundtrip, Illustrator stores its private data under
'PieceInfo/Illustrator/Private' in the page dictionary. To inspect
this data you can use CosEdit (http://www.pdftron.com/cosedit/
index.html - in the address location paste 'trailer/Root/Pages/Kids/0/
PieceInfo/Illustrator/Private').

Older versions of Illustrator were using marked content to add extra
structuring/layering information (instead of PieceInfo blob). If you
are dealing with PDF documents with custom marked content you can use
the approach described in the following Knowledge Base Article (http://
groups.google.com/group/pdfnet-sdk/browse_thread/thread/
1f3b827028124e15 - or search for "Illustrator layers").

You can also \use PDFNet SDK to extract 'PieceInfo' information (which
is using PostScript/PDF like syntax), however a simpler approach would
be to create proper PDF layers when creating the PDF file. To preserve
layer information in Illustrator choose either Acrobat 6 (PDF 1.5) or
Acrobat 7 (PDF 1.6) from the Compatibility dropdown, and then check
'Create Acrobat Layers from Top-Level Layers'. Because Illustrator
will create layers only from Top-Level Layers you may need to re-
shuffle Illustrator groups into proper layers (it is possible that
there are some Illustrator plug-ins that can facilitate this
process).

There are some other options that can be used to reconstruct layers
for PDF documents that are missing explicit layer information (e.g. by
processing e_group_begin/e_group_end elements when enumerating the
page using ElementReader class etc - www.pdftron.com/net/samplecode.html#ElementReader)
but this gets more tricky.