public class OptionalContentConfig
extends java.lang.Object
These configuration values are stored for future use.
The default configuration for a PDF document is stored in the D entry in the Optional Content Properties dictionary.
An Optional Content Group, or layer, is a set of graphic images that can be made visible or invisible within a PDF file, and the Optional Content Configuration Structure is typically used to set the initial value for these images-On or Off, visible or invisible.
| Constructor and Description |
|---|
OptionalContentConfig(Document doc)
Create a new OptionalContentConfig.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete() |
OptionalContentBaseState |
getBaseState()
Get the base state for this OptionalContentConfig.
|
java.util.List<java.lang.String> |
getIntent()
Gets the intent list for an OptionalContentConfig.
|
java.lang.String |
getName()
Get the name of the OptionalContentConfig
|
java.util.List<OptionalContentGroup> |
getOffArray()
Get the list of OptionalContentGroups in the OFF array.
|
java.util.List<OptionalContentGroup> |
getOnArray()
Get the list of OptionalContentGroups in the ON array.
|
OptionalContentOrderArray |
getOrder()
Gets the order list for the optional content in this optional content config.
|
PDFDict |
getPDFDict()
Retrieve the PDFObject representation of this object
|
void |
setBaseState(OptionalContentBaseState baseState)
Set the base state for this OptionalContentConfig.
|
void |
setIntent(java.util.List<java.lang.String> intents)
Sets the intent list for an OptionalContentConfig.
|
void |
setName(java.lang.String name)
Set the name of the optional content group
|
void |
setOffArray(java.util.List<OptionalContentGroup> ocgs)
Set the list of OptionalContentGroups in the OFF array.
|
void |
setOnArray(java.util.List<OptionalContentGroup> ocgs)
Set the list of OptionalContentGroups in the ON array.
|
public OptionalContentConfig(Document doc)
doc - The document that the new OptionalContentConfig will belong to.public void delete()
public OptionalContentOrderArray getOrder()
Note that you can set the Title property on this order list, just as on any other OptionalContentOrderArray, and it will save as a legal PDF. However, the Title property on the top level order array simply appears as an extraneous text label in a PDF Viewer Layers panel, so its use at this level is typically not required.
public OptionalContentBaseState getBaseState()
If BaseState is set to BaseStateOff, when this OptionalContentConfig is applied to an OptionalContentContext:
All OptionalContentGroups in the document are set to OFF, and
Any OptionalContentGroups in this OptionalContentConfig's ON array are then set to on.
If BaseState is set to BaseStateOn, when this OptionalContentConfig is applied to an OptionalContentContext:
All OptionalContentGroups in the document are set to ON, and
Any OptionalContentGroups in this OptionalContentConfig's OFF array are then set to off.
If BaseState is set to BaseStateUnchanged, when this OptionalContentConfig is applied to an OptionalContentContext:
Any OptionalContentGroups in this OptionalContentConfig's ON array are set to on
Any OptionalContentGroups in this OptionalContentConfig's OFF array are set to off
Any OptionalContentGroups in neither the ON or OFF array are unaffected
public void setBaseState(OptionalContentBaseState baseState)
If BaseState is set to BaseStateOff, when this OptionalContentConfig is applied to an OptionalContentContext:
All OptionalContentGroups in the document are set to OFF, and
Any OptionalContentGroups in this OptionalContentConfig's ON array are then set to on.
If BaseState is set to BaseStateOn, when this OptionalContentConfig is applied to an OptionalContentContext:
All OptionalContentGroups in the document are set to ON, and
Any OptionalContentGroups in this OptionalContentConfig's OFF array are then set to off.
If BaseState is set to BaseStateUnchanged, when this OptionalContentConfig is applied to an OptionalContentContext:
Any OptionalContentGroups in this OptionalContentConfig's ON array are set to on
Any OptionalContentGroups in this OptionalContentConfig's OFF array are set to off
Any OptionalContentGroups in neither the ON or OFF array are unaffected
baseState - The base state that will be applied to OptionalContentGroups.public java.util.List<OptionalContentGroup> getOnArray()
When this config is applied to an OptionalContentContext, the OptionalContentGroups in this array will be set to ON.
This list is ignored if the BaseState is BaseStateOn; please see the description of the BaseState property for details.
Note that an OptionalContentGroup should not be in both the ON array and the OFF array.
public void setOnArray(java.util.List<OptionalContentGroup> ocgs)
When this config is applied to an OptionalContentContext, the OptionalContentGroups in this array will be set to ON.
This list is ignored if the BaseState is BaseStateOn; please see the description of the BaseState property for details.
Note that an OptionalContentGroup should not be in both the ON array and the OFF array.
ocgs - A list of all OptionalContentGroups to be placed in the ON arraypublic java.util.List<OptionalContentGroup> getOffArray()
When this config is applied to an OptionalContentContext, the OptionalContentGroups in this array will be set to OFF.
This list is ignored if the BaseState is BaseStateOff; please see the description of the BaseState property for details.
Note that an OptionalContentGroup should not be in both the ON array and the OFF array.
public void setOffArray(java.util.List<OptionalContentGroup> ocgs)
When this config is applied to an OptionalContentContext, the OptionalContentGroups in this array will be set to OFF.
This list is ignored if the BaseState is BaseStateOff; please see the description of the BaseState property for details.
Note that an OptionalContentGroup should not be in both the ON array and the OFF array.
ocgs - A list of all OptionalContentGroups to be placed in the OFF arraypublic java.lang.String getName()
null to remove the name.public void setName(java.lang.String name)
name - The name of this OptionalContentConfig. Use null to remove the name.public java.util.List<java.lang.String> getIntent()
A config's intent is used to set the intent of an OptionalContentContext when this config is applied to the context.
public void setIntent(java.util.List<java.lang.String> intents)
A config's intent is used to set the intent of an OptionalContentContext when this config is applied to the context.
public PDFDict getPDFDict()