itext, which is the basis for pdf export, has layers. these are showing up inside the pdf, but not in illustrator. here's an example:
Code:
// http://itext.ugent.be/library/api/
//
// http://itextdocs.lowagie.com/examples/com/lowagie/examples/objects/bookmarks/Layers.java
//
import processing.opengl.*;
import processing.pdf.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
void setup() {
size(600, 600, OPENGL);
frameRate(5);
background(255);
}
void draw() {
PGraphicsPDF pdf=(PGraphicsPDF)beginRaw(PDF, "pdf_####.pdf");
PdfContentByte cb = ((PdfGraphics2D)(pdf.g2)).getContent();
PdfWriter writer = cb.getPdfWriter();
pdf.strokeJoin(MITER);
pdf.strokeCap(SQUARE);
pdf.fill(255);
pdf.noStroke();
pdf.rect(0,0, width,height);
rect( random(width/2), random(height/2), random(width), random(height) );
// these will show up in the pdf, but not in illustrator ...
//
PdfLayer l1 = new PdfLayer("Layer 1", writer);
PdfLayer l2 = new PdfLayer("Layer 2", writer);
PdfLayer l3 = new PdfLayer("Layer 3", writer);
PdfLayerMembership m1 = new PdfLayerMembership(writer);
m1.addMember(l2);
m1.addMember(l3);
cb.beginLayer(l1);
fill( 0xFFFF0000 );
rect( random(width/2), random(height/2), random(width), random(height) );
cb.endLayer();
cb.beginLayer(m1);
fill( 0xFF00FF00 );
rect( random(width/2), random(height/2), random(width), random(height) );
cb.endLayer();
cb.beginLayer(l3);
fill( 0xFF0000FF );
rect( random(width/2), random(height/2), random(width), random(height) );
cb.endLayer();
endRaw();
}
F