LayerPD_Layer
ObjectPDOCG

The PDOCCG object represents an optional-content group. This corresponds to a PDF OCG dictionary representing a collection of graphic objects that can be made visible or invisible. Any graphic content of the PDF can be made optional, including page contents, XObjects, and annotations. The specific content objects in the group have an OC entry in the PDF. The group itself is a named object that you can manipulate in the Layers panel of Acrobat 6.0 and later.

In the simplest case, the group's ON-OFF state makes the associated content visible or hidden. The ON-OFF state of a group can be toggled for a particular context (PDOCContext), and a set of states is kept in a configuration (PDOCConfig). The visibility can depend on more than one group in an optional-content membership dictionary (PDOCMD), and can also be affected by the context's or configuration's PDOCDrawEnumType.

A group has an Intent entry, an ASAtom value broadly describing the intended use, 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.

A Usage dictionary entry provides more specific intended usage information than an intent entry. Possible key values are:

The usage value can act as a kind of metadata, describing the sort of things that belong to the group, such as text in French, fine detail on a map, or a watermark. The usage values can also be used by the AutoState mechanism to make decisions about what groups should be on and what groups should be off. The AutoState mechanism considers the usage information in the OCGs, the AS array of the configuration, and external factors; for example, the language the application is running in, the current zoom level on the page, or whether the page is being printed.



Typedef Summary
 Typedef
 PDOCG
A PDOCG represents a named object whose state can be toggled in a user interface to affect changes in visibility of content.
Callback Summary
 Callback
 PDOCGEnumProc
A callback used for enumerating optional-content groups (OCGs). Enumeration stops when all OCGs have been enumerated, or when the callback returns false.
Method Summary
 Method
 
PDOCG PDOCGCreate(PDDoc pdDoc, ASConstText name)
Creates a new optional-content group (OCG) object in the document. The order of the groups (as returned by PDDocGetOCGs()) is not guaranteed, and is not the same as the display order (see PDOCConfigGetOCGOrder()).
 
Creates a new optional-content group (OCG) object from a Cos object.
 
void PDOCGDestroy(PDOCG pdocg)
Destroys an optional-content group (OCG) object. This does not delete any content, but deletes the PDOCG object, destroys the corresponding Cos object, and invalidates references from optional-content membership dictionaries (OCMDs).
 
CosObj PDOCGGetCosObj(PDOCG pdocg)
Gets the Cos object associated with the optional-content group (OCG) object.
 
ASBool PDOCGGetCurrentState(PDOCG pdocg, PDOCContext ocContext)
Gets the current ON-OFF state of the optional-content group (OCG) object in a given context.
 
Gets an optional-content group (OCG) object from the associated Cos object. If you call this multiple times for the same PDOCG, it returns the same object.
 
ASBool PDOCGGetInitialState(PDOCG pdocg, PDOCConfig pdOCCfg, ASBool* initState)
Gets a initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration. If the configuration has a BaseState of Unchanged, and the OCG is not listed explicitly in its ON list or OFF list, then the initial state is taken from the OCG's current state in the document's default context, and the method returns false.
 
ASAtom* PDOCGGetIntent(PDOCG pdocg)
Gets the intent list for an optional-content group. An intent is an ASAtom value broadly describing the intended use, either View or Design.
 
ASBool PDOCGGetLocked(PDOCG ocg, PDOCConfig pdOCCfg)
Returns the locked state of an OCG in a given configuration. The on/off state of a locked OCG cannot be toggled by the user through the user interface.
 
ASText PDOCGGetName(PDOCG pdocg)
Gets the name of an optional-content group. The returned ASText is a copy of the OCG's name. The client is free to modify it and responsible for destroying it.
 
PDDoc PDOCGGetPDDoc(PDOCG pdocg)
Gets the document that contains an optional-content group.
 
CosObj PDOCGGetUsageEntry(PDOCG pdocg, ASAtom entry)
Gets usage information from an optional-content group (OCG) object. A Usage dictionary entry provides more specific intended usage information than an intent entry. The possible key values are:
 
Tests whether the optional-content group is marked as having had its state set directly by client code in the specified context (as opposed to automatically by the optional-content AutoState mechanism).
 
ASBool PDOCGHasUsageInfo(PDOCG pdocg)
Tests whether an optional-content group (OCG) object is associated with a Usage dictionary.
 
Removes the initial ON-OFF state information for the optional-content group (OCG) object in a given configuration.
 
void PDOCGSetCurrentState(PDOCG pdocg, PDOCContext ocContext, ASBool newState)
Sets the current ON-OFF state of the optional-content group (OCG) object in a given context.
 
void PDOCGSetInitialState(PDOCG pdocg, PDOCConfig pdOCCfg, ASBool onOff)
Sets the initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration.
 
void PDOCGSetIntent(PDOCG pdocg, ASAtom* intent)
Sets the Intent entry in an optional-content group's Cos dictionary. An intent is an ASAtom value broadly describing the intended use, which can be either View or Design.
 
void PDOCGSetLocked(PDOCG ocg, PDOCConfig pdOCCfg, ASBool locked)
Sets the locked state of an OCG in a given configuration. The on/off state of a locked OCG cannot be toggled by the user through the user interface.
 
void PDOCGSetName(PDOCG pdocg, ASConstText name)
Sets the name of an optional-content group.
 
void PDOCGSetUsageDictEntry(PDOCG pdocg, ASAtom usagekey, CosObj usageinfo)
Sets a Usage dictionary entry in an optional-content group (OCG) object. The entry associates usage information with an entry key for retrieval. If a dictionary does not exist, the method creates one.
 
void PDOCGSetUserOverride(PDOCG ocg, PDOCContext ctx, ASBool overridden)
Marks the optional-content group as having had its state set directly by client code in the specified context (as opposed to automatically by the optional-content AutoState mechanism).
 
ASBool PDOCGUsedInOCConfig(PDOCG pdocg, PDOCConfig pdoccfg)
Tests whether an optional-content group (OCG) object is used in a context initialized using the given configuration.
 
ASBool PDOCGUsedInOCContext(PDOCG pdocg, PDOCContext pdocctx)
Tests whether an optional-content group (OCG) object is used in a given context.

Typedefs Detail
PDOCG 
Product availability: All
Platform availability: All

Syntax

typedef struct _t_PDOCG* PDOCG;

A PDOCG represents a named object whose state can be toggled in a user interface to affect changes in visibility of content.


File: PDExpT.h
Line: 5524


Callbacks Detail
PDOCGEnumProc 
Product availability: All
Platform availability: All

Syntax

ASBool (*PDOCGEnumProc)(PDOCG ocg, void *clientData)

A callback used for enumerating optional-content groups (OCGs). Enumeration stops when all OCGs have been enumerated, or when the callback returns false.

See Also


File: PDExpT.h
Line: 5715

Method Detail
PDOCGCreate()
Product availability: All
Platform availability: All

Syntax

PDOCG PDOCGCreate(PDDoc pdDoc, ASConstText name)

Creates a new optional-content group (OCG) object in the document. The order of the groups (as returned by PDDocGetOCGs()) is not guaranteed, and is not the same as the display order (see PDOCConfigGetOCGOrder()).

Parameters

pdDoc — 

The document in which the group is used.

 
name — 

The name of the optional-content group.

Returns

The newly created group object.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8676
PDOCGCreateFromCosObj() 
Product availability: All
Platform availability: All

Syntax

PDOCG PDOCGCreateFromCosObj(CosObj ocgObj)

Creates a new optional-content group (OCG) object from a Cos object.

Parameters

ocgObj — 

The Cos object.

Returns

The newly created OCG object.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8688
PDOCGDestroy() 
Product availability: All
Platform availability: All

Syntax

void PDOCGDestroy(PDOCG pdocg)

Destroys an optional-content group (OCG) object. This does not delete any content, but deletes the PDOCG object, destroys the corresponding Cos object, and invalidates references from optional-content membership dictionaries (OCMDs).

Parameters

pdocg — 

The optional-content group object.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8700
PDOCGGetCosObj() 
Product availability: All
Platform availability: All

Syntax

CosObj PDOCGGetCosObj(PDOCG pdocg)

Gets the Cos object associated with the optional-content group (OCG) object.

Parameters

pdocg — 

The optional-content group object.

Returns

The Cos object.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8710
PDOCGGetCurrentState() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGGetCurrentState(PDOCG pdocg, PDOCContext ocContext)

Gets the current ON-OFF state of the optional-content group (OCG) object in a given context.

Parameters

pdocg — 

The optional-content group object.

 
ocContext — 

The context for which to get the group's state.

Returns

true if the state is ON, false if it is OFF.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8964
PDOCGGetFromCosObj() 
Product availability: All
Platform availability: All

Syntax

PDOCG PDOCGGetFromCosObj(CosObj obj)

Gets an optional-content group (OCG) object from the associated Cos object. If you call this multiple times for the same PDOCG, it returns the same object.

Parameters

obj — 

The Cos object.

Returns

The OCG object.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8724
PDOCGGetInitialState() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGGetInitialState(PDOCG pdocg, PDOCConfig pdOCCfg, ASBool* initState)

Gets a initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration. If the configuration has a BaseState of Unchanged, and the OCG is not listed explicitly in its ON list or OFF list, then the initial state is taken from the OCG's current state in the document's default context, and the method returns false.

Parameters

pdocg — 

The optional-content group object.

 
pdOCCfg — 

The configuration for which to get the group's initial state.

 
initState — 

(Filled by the method) The initial state, true if the state is ON, false if it is OFF.

Returns

true if the initial state is unambiguously defined in the configuration, false otherwise.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8799
PDOCGGetIntent() 
Product availability: All
Platform availability: All

Syntax

ASAtom PDOCGGetIntent(PDOCG pdocg)

Gets the intent list for an optional-content group. An intent is an ASAtom value broadly describing the intended use, 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.

Parameters

pdocg — 

The optional-content group object for which the intent is desired.

Returns

An array containing intent entries (ASAtom objects) terminated by ASAtomNull. The client is responsible for freeing it using ASfree().

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8948
PDOCGGetLocked() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGGetLocked(PDOCG ocg, PDOCConfig pdOCCfg)

Returns the locked state of an OCG in a given configuration. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

Parameters

ocg — 

IN The PDOCG whose locked state is requested.

 
pdOCCfg — 

IN The optional-content configuration.

Returns

An ASBool that is true if the OCG is locked, and false if it is unlocked.

See Also

Since

PI_PDMODEL_VERSION >= 0x00070000

File: PDProcs.h
Line: 11016
PDOCGGetName() 
Product availability: All
Platform availability: All

Syntax

ASText PDOCGGetName(PDOCG pdocg)

Gets the name of an optional-content group. The returned ASText is a copy of the OCG's name. The client is free to modify it and responsible for destroying it.

Parameters

pdocg — 

The optional-content group object for which the name is desired.

Returns

The name string.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8757
PDOCGGetPDDoc() 
Product availability: All
Platform availability: All

Syntax

PDDoc PDOCGGetPDDoc(PDOCG pdocg)

Gets the document that contains an optional-content group.

Parameters

pdocg — 

The optional-content group object for which the document is desired.

Returns

The document object.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8736
PDOCGGetUsageEntry() 
Product availability: All
Platform availability: All

Syntax

CosObj PDOCGGetUsageEntry(PDOCG pdocg, ASAtom entry)

Gets usage information from an optional-content group (OCG) object. A Usage dictionary entry provides more specific intended usage information than an intent entry. The possible key values are:

Parameters

pdocg — 

The optional-content group object.

 
entry — 

The usage key in the usage dictionary entry.

Returns

The usage information associated with the given key in the Usage dictionary for the group, or a NULL Cos object if the operation fails (because the OCG is malformed or has no dictionary, or because the dictionary has no entry corresponding to the given key).

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8899
PDOCGGetUserOverride() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGGetUserOverride(PDOCG ocg, PDOCContext ctx)

Tests whether the optional-content group is marked as having had its state set directly by client code in the specified context (as opposed to automatically by the optional-content AutoState mechanism).

When a group is so marked, automatic state changes caused by the View event are prevented. When a group's automatic state change is caused by the Export or Print event, the user-override setting for the group is ignored.

A configuration's AS array defines how usage entries are used to automatically manipulate the OCG states. It associates an event (View, Print, or Export) with a list of OCGs and a category, or list of usage keys identifying OCG usage dictionary entries. See the PDF Reference, and the OCTextAutoStateSnip example in the Snippet Runner.

Parameters

ocg — 

The optional-content group object.

 
ctx — 

The context for which the group is tested.

Returns

true if the group is marked as being overridden in the context, false otherwise.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 10299
PDOCGHasUsageInfo() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGHasUsageInfo(PDOCG pdocg)

Tests whether an optional-content group (OCG) object is associated with a Usage dictionary.

Parameters

pdocg — 

The optional-content group object.

Returns

true if the group has a Usage dictionary, false otherwise.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8869
PDOCGRemoveInitialState() 
Product availability: All
Platform availability: All

Syntax

void PDOCGRemoveInitialState(PDOCG pdocg, PDOCConfig pdOCCfg)

Removes the initial ON-OFF state information for the optional-content group (OCG) object in a given configuration.

Parameters

pdocg — 

The optional-content group object.

 
pdOCCfg — 

The configuration for which to remove the group's initial state.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8816
PDOCGSetCurrentState() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetCurrentState(PDOCG pdocg, PDOCContext ocContext, ASBool newState)

Sets the current ON-OFF state of the optional-content group (OCG) object in a given context.

Parameters

pdocg — 

The optional-content group object.

 
ocContext — 

The context for which to set the group's state.

 
newState — 

The new state.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8982
PDOCGSetInitialState() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetInitialState(PDOCG pdocg, PDOCConfig pdOCCfg, ASBool onOff)

Sets the initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration.

Parameters

pdocg — 

The optional-content group object.

 
pdOCCfg — 

The configuration for which to set the group's initial state.

 
onOff — 

The new initial state, true if the state is ON, false if it is OFF.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8775
PDOCGSetIntent() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetIntent(PDOCG pdocg, ASAtom* intent)

Sets the Intent entry in an optional-content group's Cos dictionary. An intent is an ASAtom value 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.

Parameters

pdocg — 

The optional-content group object for which the intent is desired.

 
intent — 

The new Intent entry value, an array of atoms terminated with ASAtomNull.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8923
PDOCGSetLocked() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetLocked(PDOCG ocg, PDOCConfig pdOCCfg, ASBool locked)

Sets the locked state of an OCG in a given configuration. The on/off state of a locked OCG cannot be toggled by the user through the user interface.

Parameters

ocg — 

IN The PDOCG whose locked state is to be set.

 
pdOCCfg — 

IN/OUT The optional-content configuration.

 
locked — 

IN An ASBool that is true if the OCG should be locked, and false if it should be unlocked.

See Also

Since

PI_PDMODEL_VERSION >= 0x00070000

File: PDProcs.h
Line: 11031
PDOCGSetName() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetName(PDOCG pdocg, ASConstText name)

Sets the name of an optional-content group.

Parameters

pdocg — 

The optional-content group object.

 
name — 

The new name string.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8745
PDOCGSetUsageDictEntry() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetUsageDictEntry(PDOCG pdocg, ASAtom usagekey, CosObj usageinfo)

Sets a Usage dictionary entry in an optional-content group (OCG) object. The entry associates usage information with an entry key for retrieval. If a dictionary does not exist, the method creates one.

A Usage dictionary entry provides more specific intended usage information than an intent entry. The possible key values are:

The usage value can act as a kind of metadata, describing the sort of things that belong to the group, such as text in French, fine detail on a map, or a watermark. The usage values can also be used by the AutoState mechanism to make decisions about what groups should be on and what groups should be off. The AutoState mechanism considers the usage information in the OCGs, the AS array of the configuration, and external factors; for example, the language the application is running in, the current zoom level on the page, or if the page is being printed.

Parameters

pdocg — 

The optional-content group object.

 
usagekey — 

The usage entry key.

 
usageinfo — 

The usage information to associate with the key.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 8857
PDOCGSetUserOverride() 
Product availability: All
Platform availability: All

Syntax

void PDOCGSetUserOverride(PDOCG ocg, PDOCContext ctx, ASBool overridden)

Marks the optional-content group as having had its state set directly by client code in the specified context (as opposed to automatically by the optional-content AutoState mechanism).

When a group is so marked, automatic state changes caused by the View event are prevented. When a group's automatic state change is caused by the Export or Print event, the user-override setting for the group is ignored.

A configuration's AS array defines how usage entries are used to automatically manipulate the OCG states. It associates an event (View, Print, or Export) with a list of OCGs and a category, or list of usage keys identifying OCG usage dictionary entries. See the PDF Reference, and the OCTextAutoStateSnip example in the Snippet Runner.

Parameters

ocg — 

The optional-content group object.

 
ctx — 

The context for which the group is marked.

 
overridden — 

true to mark the group as having had its state set manually, false to clear the mark.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 10268
PDOCGUsedInOCConfig() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGUsedInOCConfig(PDOCG pdocg, PDOCConfig pdoccfg)

Tests whether an optional-content group (OCG) object is used in a context initialized using the given configuration.

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.

Parameters

pdocg — 

The optional-content group object.

 
pdoccfg — 

The optional-content configuration.

Returns

true if the group is taken into consideration when determining the visibility of content, false otherwise.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 9028
PDOCGUsedInOCContext() 
Product availability: All
Platform availability: All

Syntax

ASBool PDOCGUsedInOCContext(PDOCG pdocg, PDOCContext pdocctx)

Tests whether an optional-content group (OCG) object is used in a given context.

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.

Parameters

pdocg — 

The optional-content group object.

 
pdocctx — 

The optional-content context.

Returns

true if the group is taken into consideration when determining the visibility of content, false otherwise.

See Also

Since

PI_PDMODEL_VERSION >= 0x00060000

File: PDProcs.h
Line: 9005