public class

Config

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.ocg.Config

Class Overview

The OCG::Config object represents an optional-content (OC) configuration structure (see section 4.10.3 in PDF Reference), used to persist a set of visibility states and other optional-content information in a PDF file A document has a default configuration, saved in the D entry in the 'OCProperties' dictionary (that can be obtained using pdfdoc.GetOCConfig()), and can have a list of other configurations, saved as an array in the 'Configs' entry in the OCProperties dictionary.

Configurations are typically used to initialize the OCG ON-OFF states for an optional-content context (OCG::Context). The OCG order in the configuration is the order in which the groups appear in the Layers panel of a PDF viewer. The configuration can also define a set of mutually exclusive OCGs, called a radio button group.

Summary

Public Constructors
Config(Obj ocg_config)
Creates a new optional-content configuration from an existing SDF/Cos object.
Public Methods
boolean IsValid()
Determine whether configuraiton is valid
static Config __Create(long impl, Object ref)
static Config create(PDFDoc doc, boolean default_config)
Creates a new optional-content configuration object in the document.
String getCreator()
Get the creator property of an optional-content configuration
String getInitBaseState()
Get base initialization state

Note: If BaseState is present in the document's default configuration dictionary, its value must be "ON".

Obj getInitOffStates()
Get the initialization of the "OFF" states.
Obj getInitOnStates()
Get the initialization of the "ON" states.
Obj getIntent()
Get the intent.
Obj getLockedOCGs()
Get the locked optional-content groups
String getName()
Get the name of an option-content configuration
Obj getOrder()
Get the order of otpional content groups
Obj getSDFObj()
Get the SDFObj.
void setCreator(String name)
Set the creator property of an optional-content configuration.
void setInitBaseState(String state)
Set the base initialization state.
void setInitOffStates(Obj off_array)
Set the 'OFF' initialization array in the configuration dictionary.
void setInitOnStates(Obj on_array)
Set the 'ON' initialization array in the configuration dictionary.
void setIntent(Obj intent)
Set the Intent entry in an optional-content configuration's SDF/Cos dictionary.
void setLockedOCGs(Obj locked_ocg_array)
Set the array of locked OCGs.
void setName(String name)
Set the name of an optional-content configuration (suitable for presentation in a user interface).
void setOrder(Obj ocgs_array)
Set the user interface display order of optional-content groups (OCGs) in this configuration.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Config (Obj ocg_config)

Creates a new optional-content configuration from an existing SDF/Cos object.

Parameters
ocg_config the ocg_config

Public Methods

public boolean IsValid ()

Determine whether configuraiton is valid

Returns
  • true is this is a valid (non-null) configuration, false otherwise.

public static Config __Create (long impl, Object ref)

public static Config create (PDFDoc doc, boolean default_config)

Creates a new optional-content configuration object in the document.

Parameters
doc The document in which the new OCG::Config will be created.
default_config If true, the configuration will be set as the default OCG configuration (i.e. listed as a D entry under 'OCProperies' dictionary).
Returns
  • The newly created configuration object.

public String getCreator ()

Get the creator property of an optional-content configuration

Returns
  • the creator property of an optional-content configuration. The string is used to represent the name of the application or feature that created this configuration.

public String getInitBaseState ()

Get base initialization state

Note: If BaseState is present in the document's default configuration dictionary, its value must be "ON".

Returns
  • the base initialization state. This state is used to initialize the states of all the OCGs in a document when this configuration is applied. The value of this entry must be one of the following names:
    • ON: The states of all groups are turned ON.
    • OFF: The states of all groups are turned OFF.
    • Unchanged: The states of all groups are left unchanged.

    After base initialization, the contents of the ON and OFF arrays are processed, overriding the state of the groups included in the arrays.

public Obj getInitOffStates ()

Get the initialization of the "OFF" states.

Returns
  • the "OFF" initialization array from the configuration dictionary or NULL if the array is not present. The returned object is an array of optional content groups whose state should be set to OFF when this configuration is applied. Note: If the BaseState entry is OFF, this entry is redundant.

public Obj getInitOnStates ()

Get the initialization of the "ON" states.

Returns
  • the "ON" initialization array from the configuration dictionary or NULL if the array is not present. The returned object is an array of optional content groups whose state should be set to ON when this configuration is applied. Note: If the BaseState entry is ON, this entry is redundant.

public Obj getIntent ()

Get the intent.

Returns
  • OCG configuration intent. An intent is a name object (or an array of name objects) broadly describing the intended use, which can be either "View" or "Design". A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration. If the configuration has no Intent entry, the default value of "View" is used.

public Obj getLockedOCGs ()

Get the locked optional-content groups

Returns
  • the list of locked OCGs or NULL if there are no locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

public String getName ()

Get the name of an option-content configuration

Returns
  • the name of an optional-content configuration (suitable for presentation in a user interface).

public Obj getOrder ()

Get the order of otpional content groups

Returns
  • the Obj array that specifies the order of optional content (OC) groups in this configuration or NULL if the configuration does not contain any OCGs. The order of OCGs in the array is used to represent the order in which the group names are displayed in the Layers panel of a PDF viewer application. For more information, please refer to Section 4.10.3 in the PDF Reference.

public Obj getSDFObj ()

Get the SDFObj.

Returns
  • Pointer to the underlying SDF/Cos object.

public void setCreator (String name)

Set the creator property of an optional-content configuration. Stores the specified string as the Creator entry in the configuration's SDF/Cos dictionary.

Parameters
name The new creator string.

public void setInitBaseState (String state)

Set the base initialization state. For more info, please see GetInitBaseState().

Parameters
state new base state ("ON", "OFF", or "Unchanged").

public void setInitOffStates (Obj off_array)

Set the 'OFF' initialization array in the configuration dictionary. For more info, please see SetInitOffStates() and section 4.10.3 in PDF Reference.

Parameters
off_array the new inits the off states

public void setInitOnStates (Obj on_array)

Set the 'ON' initialization array in the configuration dictionary. For more info, please see SetInitOnStates() and section 4.10.3 in PDF Reference.

Parameters
on_array the new inits the on states

public void setIntent (Obj intent)

Set the Intent entry in an optional-content configuration's SDF/Cos dictionary. For more information, see GetIntent().

Parameters
intent The new Intent entry value (a name object or an array of name objects).

public void setLockedOCGs (Obj locked_ocg_array)

Set the array of locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

Parameters
locked_ocg_array An SDF/Cos array of OCG objects to be locked in this configuration, or an empty array if the configuration should not contain locked OCGs. The default is the empty array.

public void setName (String name)

Set the name of an optional-content configuration (suitable for presentation in a user interface). The method stores the specified string as the Name entry in the configuration's SDF/Cos dictionary.

Parameters
name The new name string.

public void setOrder (Obj ocgs_array)

Set the user interface display order of optional-content groups (OCGs) in this configuration. This is the order in which the group names are displayed in the Layers panel of a PDF viewer.

Parameters
ocgs_array The SDF/Cos object containing the OCG order array. For more information, please refer to section 4.10.3 in the PDF Reference.