Skip to content
rohannayak90 edited this page Jan 20, 2016 · 3 revisions

##What is PdfLayerMembership and how to use it ##Introduction With PdfLayerMembership you can provide optional contents to a pdf document. PdfLayerMembership can be used like a PdfLayer, so you can draw everything you want in it.

With PdfLayerMembership you assign members ( other PdfLayer(s) ) and a visibilityPolicy.

visibilityPolicy can be one of these PdfLayerMembership public constants: ALLON, ALLOFF, ANYON, ANYOFF.

In this way, once the visibility policy is satisfied the PdfLayerMembership instance will be visible, otherwise it will remains invisible into the pdf document.

##Details Take this example code:

var dog: PdfLayer = new PdfLayer("Layer 1", writer);
var tiger: PdfLayer = new PdfLayer("Layer 2", writer);
var lion: PdfLayer = new PdfLayer("Layer 3", writer);


var no_cat: PdfLayerMembership = new PdfLayerMembership( writer );
no_cat.addMember( tiger );
no_cat.addMember( lion );
no_cat.visibilityPolicy = PdfLayerMembership.ALLOFF;

In this example, the no_cat layer will be visible into the pdf document only once both tiger and lion layers will be set invisible ( for instance by the user who is reading the document )

For a practical example see this: LayerMembershipExample.as

Clone this wiki locally