public class

OCMD

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

Class Overview

The OCMD object represents an Optional Content Membership Dictionary (OCMD) that allows the visibility of optional content to depend on the states in a set of optional-content groups (OCG::Group). The object directly corresponds to the OCMD dictionary (Section 4.10.1 'Optional Content Groups' in PDF Reference).

An OCMD collects a set of OCGs. It sets a visibility policy, so that content in the member groups is visible only when all groups are ON or OFF, or when any of the groups is ON or OFF. This makes it possible to set up complex dependencies among groups. For example, an object can be visible only if some other conditions are met (such as if another layer is visible).

Summary

Constants
int e_AllOff The Constant e_AllOff.
int e_AllOn Visibility Policy Type.
int e_AnyOff The Constant e_AnyOff.
int e_AnyOn The Constant e_AnyOn.
Public Constructors
OCMD(Obj ocmd)
Creates a new optional-content group (OCG) object from an existing SDF/Cos object.
Public Methods
static OCMD __Create(long impl, Object ref)
static OCMD create(PDFDoc doc, Obj ocgs, int vis_policy)
Creates a new optional-content membership dictionary (OCMD) object in the given document for the given groups and visibility policy.
Obj getOCGs()
Get the optional-content groups listed under 'OCGs' entry in the object dictionary.
Obj getSDFObj()
Get the SDFObj.
Obj getVisibilityExpression()
Get the visibility expression.
int getVisibilityPolicy()
Get the optional-content membership dictionary's visibility policy, which determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary.
boolean isValid()
Determine whether OCMD is valid
void setVisibilityPolicy(int vis_policy)
Set the optional-content membership dictionary's visibility policy, which determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int e_AllOff

The Constant e_AllOff.

Constant Value: 3 (0x00000003)

public static final int e_AllOn

Visibility Policy Type. A Visibility Policy is used to determine whether an PDF::Element is visible in a given OCG::Context, depending on whether all groups in OCGs array are "ON" or "OFF", or when any of the groups is "ON" or "OFF".

Constant Value: 0 (0x00000000)

public static final int e_AnyOff

The Constant e_AnyOff.

Constant Value: 2 (0x00000002)

public static final int e_AnyOn

The Constant e_AnyOn.

Constant Value: 1 (0x00000001)

Public Constructors

public OCMD (Obj ocmd)

Creates a new optional-content group (OCG) object from an existing SDF/Cos object.

Parameters
ocmd the ocmd

Public Methods

public static OCMD __Create (long impl, Object ref)

public static OCMD create (PDFDoc doc, Obj ocgs, int vis_policy)

Creates a new optional-content membership dictionary (OCMD) object in the given document for the given groups and visibility policy.

Parameters
doc The document in which the new OCMD will be created.
ocgs An array of optional-content groups (OCGs) to be members of the dictionary.
vis_policy the vis_policy
Returns
  • The newly created OCG::OCMD object.

public Obj getOCGs ()

Get the optional-content groups listed under 'OCGs' entry in the object dictionary.

Returns
  • An SDF::Obj array or OCG::Group objects or NULL is the array is not present.

public Obj getSDFObj ()

Get the SDFObj.

Returns
  • Pointer to the underlying SDF/Cos object.

public Obj getVisibilityExpression ()

Get the visibility expression.

Returns
  • If the PDOCMD has a visibility expression entry, return the SDF::Obj array object representing the expression, otherwise returns NULL.

public int getVisibilityPolicy ()

Get the optional-content membership dictionary's visibility policy, which determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary.

Returns
  • The visibility policy.

public boolean isValid ()

Determine whether OCMD is valid

Returns
  • True if this is a valid (non-null) OCG, false otherwise.

public void setVisibilityPolicy (int vis_policy)

Set the optional-content membership dictionary's visibility policy, which determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary.

Parameters
vis_policy New visibility policy.