Skip to content

# PDFSetOptionalContentGroupStateAction

Namespace: O2S.Components.PDF4NET.Actions

Defines a set-OCG-state action.

    public class PDFSetOptionalContentGroupStateAction : PDFAction

Inheritance Object → PDFAction → PDFSetOptionalContentGroupStateAction

Remarks

A set-OCG-state action sets the state of one or more optional content groups. Use the AddState and AddOptionalContentGroup methods to build the sequence of states for activating, deactivating and toggling the optional content groups.

## Constructors

### PDFSetOptionalContentGroupStateAction()

Initializes a new PDFSetOptionalContentGroupStateAction object.

    public PDFSetOptionalContentGroupStateAction()

## Properties

### Actions

Gets or sets the sequence of actions to be performed after this action.

    public PDFActionCollection Actions { get; set; }

Property Value

PDFActionCollection
The sequence of actions to be performed after this action.

### CosAction

Gets the cos action object.

    public PDFCosDictionary CosAction { get; }

Property Value

PDFCosDictionary
The cos action dictionary.

Remarks

Direct changes to cos action dictionary can lead to unexpected results if they do not follow the PDF specification.

### Type

Gets the type of this action.

    public PDFActionType Type { get; }

Property Value

PDFActionType
A PDFActionType enum member specifying the type of this action.

## Methods

### AddOptionalContentGroup(PDFOptionalContentGroup)

Adds a new optional content group to this action.

    public void AddOptionalContentGroup(PDFOptionalContentGroup ocg)

Parameters

`ocg` PDFOptionalContentGroup
The optional content group whose state will be changed.

### AddState(String)

Adds a new state to this action.

    public void AddState(string state)

Parameters

`state` String
New state, can be ON, OFF or Toggle.