Class Config
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.
Inherited Members
Namespace: pdftron.PDF.OCG
Assembly: PDFTronDotNet.dll
Syntax
public class Config
Constructors
Config(Obj)
Creates a new optional-content configuration from an existing SDF Cos object.
Declaration
public Config(Obj ocg_config)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | ocg_config | existing OCG configuration |
Methods
Create(PDFDoc, bool)
Creates a new optional-content configuration from an existing SDF/Cos object.
Declaration
public static Config Create(PDFDoc doc, bool default_config)
Parameters
| Type | Name | Description |
|---|---|---|
| PDFDoc | doc | document to create OCG configuration in |
| bool | default_config | whether to use default configuration |
Returns
| Type | Description |
|---|---|
| Config | newly created configuration |
GetCreator()
Gets the creator.
Declaration
public string GetCreator()
Returns
| Type | Description |
|---|---|
| string | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetInitBaseState()
Gets the inits the base state.
Declaration
public string GetInitBaseState()
Returns
| Type | Description |
|---|---|
| string | 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:
After base initialization, the contents of the ON and OFF arrays are processed, overriding the state of the groups included in the arrays. |
Remarks
If BaseState is present in the document's default configuration dictionary, its value must be "ON".
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetInitOffStates()
Gets the inits the off states.
Declaration
public Obj GetInitOffStates()
Returns
| Type | Description |
|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetInitOnStates()
Gets the inits the on states.
Declaration
public Obj GetInitOnStates()
Returns
| Type | Description |
|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetIntent()
Gets the intent.
Declaration
public Obj GetIntent()
Returns
| Type | Description |
|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetLockedOCGs()
Gets the locked oc gs.
Declaration
public Obj GetLockedOCGs()
Returns
| Type | Description |
|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetName()
Gets the name.
Declaration
public string GetName()
Returns
| Type | Description |
|---|---|
| string | the name of an optional-content configuration (suitable for presentation in a user interface). |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetOrder()
Gets the order.
Declaration
public Obj GetOrder()
Returns
| Type | Description |
|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetRBGroups()
Gets the radio button groups.
Declaration
public Obj GetRBGroups()
Returns
| Type | Description |
|---|---|
| Obj | The Obj array that specifies the radio button groups or NULL if there are no radio button groups. Each group (an array) represents a collection of optional content groups whose states shall be intended to follow a radio button paradigm. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
GetSDFObj()
Gets the SDFObj.
Declaration
public Obj GetSDFObj()
Returns
| Type | Description |
|---|---|
| Obj | Pointer to the underlying SDF/Cos object. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetCreator(string)
Sets the creator property of an optional-content configuration. Stores the specified string as the Creator entry in the configuration's SDF/Cos dictionary.
Declaration
public void SetCreator(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The new creator string. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetInitBaseState(string)
Sets the base initialization state. For more info, please see GetInitBaseState().
Declaration
public void SetInitBaseState(string state)
Parameters
| Type | Name | Description |
|---|---|---|
| string | state | new base state ("ON", "OFF", or "Unchanged"). |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetInitOffStates(Obj)
Sets the 'OFF' initialization array in the configuration dictionary. For more info, please see SetInitOffStates() and section 4.10.3 in PDF Reference.
Declaration
public void SetInitOffStates(Obj off_array)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | off_array | the new inits the off states |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetInitOnStates(Obj)
Sets the 'ON' initialization array in the configuration dictionary. For more info, please see SetInitOnStates() and section 4.10.3 in PDF Reference.
Declaration
public void SetInitOnStates(Obj on_array)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | on_array | the new inits the on states |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetIntent(Obj)
Sets the Intent entry in an optional-content configuration's SDF/Cos dictionary. For more information, see GetIntent().
Declaration
public void SetIntent(Obj intent)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | intent | The new Intent entry value (a name object or an array of name objects). |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetLockedOCGs(Obj)
Sets the array of locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface.
Declaration
public void SetLockedOCGs(Obj locked_ocg_array)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetName(string)
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.
Declaration
public void SetName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The new name string. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetOrder(Obj)
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.
Declaration
public void SetOrder(Obj ocgs_array)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | 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. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetRBGroups(Obj)
Sets the radio button groups of optional-content groups (OCGs) in this configuration.
Declaration
public void SetRBGroups(Obj rbgroups_array)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | rbgroups_array | An SDF/Cos object containing the radio button groups. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |