pdftron::PDF::OCG::Config Class Reference

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. More...

#include <Config.h>

List of all members.

Public Member Functions

 Config (SDF::Obj ocg_config)
 Creates a new optional-content configuration from an existing SDF/Cos object.
bool IsValid () const
SDF::Obj GetOrder () const
void SetOrder (SDF::Obj ocgs_array)
 Sets the user interface display order of optional-content groups (OCGs) in this configuration.
UString GetName () const
void SetName (const UString &name)
 Sets the name of an optional-content configuration (suitable for presentation in a user interface).
UString GetCreator () const
void SetCreator (const UString &name)
 Sets the creator property of an optional-content configuration.
const char * GetInitBaseState () const
SDF::Obj GetInitOnStates () const
SDF::Obj GetInitOffStates () const
void SetInitBaseState (const char *state="ON")
 Sets the base initialization state.
void SetInitOnStates (SDF::Obj on_array)
 Sets the 'ON' initialization array in the configuration dictionary.
void SetInitOffStates (SDF::Obj off_array)
 Sets the 'OFF' initialization array in the configuration dictionary.
SDF::Obj GetIntent () const
void SetIntent (SDF::Obj intent)
 Sets the Intent entry in an optional-content configuration's SDF/Cos dictionary.
SDF::Obj GetLockedOCGs () const
void SetLockedOCGs (SDF::Obj locked_ocg_array)
 Sets the array of locked OCGs.
SDF::Obj GetSDFObj () const
 Config (const Config &g)
 Copy constructor.
Configoperator= (const Config &g)

Static Public Member Functions

static Config Create (PDFDoc &doc, bool default_config)
 Creates a new optional-content configuration object in the document.


Detailed Description

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.


Constructor & Destructor Documentation

pdftron::PDF::OCG::Config::Config ( SDF::Obj  ocg_config  ) 

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

pdftron::PDF::OCG::Config::Config ( const Config g  ) 

Copy constructor.


Member Function Documentation

static Config pdftron::PDF::OCG::Config::Create ( PDFDoc doc,
bool  default_config 
) [static]

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.

bool pdftron::PDF::OCG::Config::IsValid (  )  const [inline]

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

SDF::Obj pdftron::PDF::OCG::Config::GetOrder (  )  const

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.

void pdftron::PDF::OCG::Config::SetOrder ( SDF::Obj  ocgs_array  ) 

Sets 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.

UString pdftron::PDF::OCG::Config::GetName (  )  const

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

void pdftron::PDF::OCG::Config::SetName ( const UString name  ) 

Sets 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.

UString pdftron::PDF::OCG::Config::GetCreator (  )  const

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.

void pdftron::PDF::OCG::Config::SetCreator ( const UString name  ) 

Sets 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.

const char* pdftron::PDF::OCG::Config::GetInitBaseState (  )  const

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.

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

SDF::Obj pdftron::PDF::OCG::Config::GetInitOnStates (  )  const

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.

SDF::Obj pdftron::PDF::OCG::Config::GetInitOffStates (  )  const

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.

void pdftron::PDF::OCG::Config::SetInitBaseState ( const char *  state = "ON"  ) 

Sets the base initialization state.

For more info, please see GetInitBaseState().

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

void pdftron::PDF::OCG::Config::SetInitOnStates ( SDF::Obj  on_array  ) 

Sets the 'ON' initialization array in the configuration dictionary.

For more info, please see SetInitOnStates() and section 4.10.3 in PDF Reference.

void pdftron::PDF::OCG::Config::SetInitOffStates ( SDF::Obj  off_array  ) 

Sets the 'OFF' initialization array in the configuration dictionary.

For more info, please see SetInitOffStates() and section 4.10.3 in PDF Reference.

SDF::Obj pdftron::PDF::OCG::Config::GetIntent (  )  const

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.

void pdftron::PDF::OCG::Config::SetIntent ( SDF::Obj  intent  ) 

Sets 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).

SDF::Obj pdftron::PDF::OCG::Config::GetLockedOCGs (  )  const

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.

void pdftron::PDF::OCG::Config::SetLockedOCGs ( SDF::Obj  locked_ocg_array  ) 

Sets 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.

SDF::Obj pdftron::PDF::OCG::Config::GetSDFObj (  )  const

Returns:
Pointer to the underlying SDF/Cos object.

Config& pdftron::PDF::OCG::Config::operator= ( const Config g  ) 


© 2002-2010 PDFTron Systems Inc.