Package org.faceless.pdf2
Class OptionalContentDescriptor
- java.lang.Object
-
- org.faceless.pdf2.OptionalContentDescriptor
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
OptionalContentLayer
public class OptionalContentDescriptor extends Object
An OptionalContentDescriptor is either an
OptionalContentLayer
or a logical expression containing one or two OptionalContentDescriptors.Here's an example showing how to make a canvas visible when either the "interior" or "exterior" layers are selected as enabled in the viewer.
OptionalContentLayer interior = new OptionalContentLayer("interior"); OptionalContentLayer exterior = new OptionalContentLayer("exterior"); OptionalContentDescriptor or = OptionalContentDescriptor.or(interior, exterior); pdfcanvas.setOptionalContentDescriptor(or); pdf.getOptionalContentLayers().add(interior); pdf.getOptionalContentLayers().add(exterior);
- Since:
- 2.23.5
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OptionalContentDescriptor
and(OptionalContentDescriptor a, OptionalContentDescriptor b)
Create a Descriptor which will enable the canvas with BOTH descriptors A and B are enabledprotected Object
clone()
String
getName()
Return the "name" of this OptionalContentDescriptor.boolean
isEnabled()
Return true if this Optional Content Descriptor is enabled by default.static OptionalContentDescriptor
not(OptionalContentDescriptor a)
Create a Descriptor which will enable the canvas when descriptor a is NOT enabled.static OptionalContentDescriptor
or(OptionalContentDescriptor a, OptionalContentDescriptor b)
Create a Descriptor which will enable the canvas with EITHER of descriptors A and B are enabledvoid
putLiteral(String key, String tokens)
Put a literal token sequnce.String
toString()
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Return true if this Optional Content Descriptor is enabled by default. For objects created withand(org.faceless.pdf2.OptionalContentDescriptor, org.faceless.pdf2.OptionalContentDescriptor)
,or(org.faceless.pdf2.OptionalContentDescriptor, org.faceless.pdf2.OptionalContentDescriptor)
ornot(org.faceless.pdf2.OptionalContentDescriptor)
, the value is derived from its children.- Since:
- 2.24.3
-
getName
public String getName()
Return the "name" of this OptionalContentDescriptor. For objects created withand(org.faceless.pdf2.OptionalContentDescriptor, org.faceless.pdf2.OptionalContentDescriptor)
,or(org.faceless.pdf2.OptionalContentDescriptor, org.faceless.pdf2.OptionalContentDescriptor)
ornot(org.faceless.pdf2.OptionalContentDescriptor)
, the value is derived from its children.- Since:
- 2.24.3
-
toString
public String toString()
-
and
public static OptionalContentDescriptor and(OptionalContentDescriptor a, OptionalContentDescriptor b)
Create a Descriptor which will enable the canvas with BOTH descriptors A and B are enabled- Parameters:
a
- the first descriptorb
- the first descriptor
-
or
public static OptionalContentDescriptor or(OptionalContentDescriptor a, OptionalContentDescriptor b)
Create a Descriptor which will enable the canvas with EITHER of descriptors A and B are enabled- Parameters:
a
- the first descriptorb
- the first descriptor
-
not
public static OptionalContentDescriptor not(OptionalContentDescriptor a)
Create a Descriptor which will enable the canvas when descriptor a is NOT enabled.- Parameters:
a
- the descriptor to invert
-
putLiteral
public void putLiteral(String key, String tokens)
Put a literal token sequnce. For debugging- Parameters:
key
- the keytokens
- the token sequence, eg "true" or "/foo" or "[/Foo/Bar]". No refs, just direct objects.
-
-