Package com.itextpdf.text.pdf
Class PdfLayerMembership
- java.lang.Object
-
- com.itextpdf.text.pdf.PdfObject
-
- com.itextpdf.text.pdf.PdfDictionary
-
- com.itextpdf.text.pdf.PdfLayerMembership
-
- All Implemented Interfaces:
PdfOCG
,java.io.Serializable
public class PdfLayerMembership extends PdfDictionary implements PdfOCG
Content typically belongs to a single optional content group, and is visible when the group is ON and invisible when it is OFF. To express more complex visibility policies, content should not declare itself to belong to an optional content group directly, but rather to an optional content membership dictionary represented by this class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static PdfName
ALLOFF
Visible only if all of the entries are OFF.static PdfName
ALLON
Visible only if all of the entries are ON.static PdfName
ANYOFF
Visible if any of the entries are OFF.static PdfName
ANYON
Visible if any of the entries are ON.(package private) java.util.HashSet<PdfLayer>
layers
(package private) PdfArray
members
(package private) PdfIndirectReference
ref
-
Constructor Summary
Constructors Constructor Description PdfLayerMembership(PdfWriter writer)
Creates a new, empty, membership layer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMember(PdfLayer layer)
Adds a new member to the layer.java.util.Collection<PdfLayer>
getLayers()
Gets the member layers.PdfObject
getPdfObject()
Gets the dictionary representing the membership layer.PdfIndirectReference
getRef()
Gets thePdfIndirectReference
that represents this membership layer.void
setVisibilityExpression(PdfVisibilityExpression ve)
Sets the visibility expression for content belonging to this membership dictionary.void
setVisibilityPolicy(PdfName type)
Sets the visibility policy for content belonging to this membership dictionary.-
Methods inherited from class com.itextpdf.text.pdf.PdfDictionary
checkType, clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString
-
Methods inherited from class com.itextpdf.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
-
-
-
Field Detail
-
ALLON
public static final PdfName ALLON
Visible only if all of the entries are ON.
-
ANYON
public static final PdfName ANYON
Visible if any of the entries are ON.
-
ANYOFF
public static final PdfName ANYOFF
Visible if any of the entries are OFF.
-
ALLOFF
public static final PdfName ALLOFF
Visible only if all of the entries are OFF.
-
ref
PdfIndirectReference ref
-
members
PdfArray members
-
layers
java.util.HashSet<PdfLayer> layers
-
-
Constructor Detail
-
PdfLayerMembership
public PdfLayerMembership(PdfWriter writer)
Creates a new, empty, membership layer.- Parameters:
writer
- the writer
-
-
Method Detail
-
getRef
public PdfIndirectReference getRef()
Gets thePdfIndirectReference
that represents this membership layer.
-
addMember
public void addMember(PdfLayer layer)
Adds a new member to the layer.- Parameters:
layer
- the new member to the layer
-
getLayers
public java.util.Collection<PdfLayer> getLayers()
Gets the member layers.- Returns:
- the member layers
-
setVisibilityPolicy
public void setVisibilityPolicy(PdfName type)
Sets the visibility policy for content belonging to this membership dictionary. Possible values are ALLON, ANYON, ANYOFF and ALLOFF. The default value is ANYON.- Parameters:
type
- the visibility policy
-
setVisibilityExpression
public void setVisibilityExpression(PdfVisibilityExpression ve)
Sets the visibility expression for content belonging to this membership dictionary.- Parameters:
ve
- A (nested) array of which the first value is /And, /Or, or /Not followed by a series of indirect references to OCGs or other visibility expressions.- Since:
- 5.0.2
-
getPdfObject
public PdfObject getPdfObject()
Gets the dictionary representing the membership layer. It just returnsthis
.- Specified by:
getPdfObject
in interfacePdfOCG
- Returns:
- the dictionary representing the layer
-
-