class HexaPDF::Type::Actions::SetOCGState


A Set-OCG-state action changes the state of one or more optional content groups.

See: PDF2.0 s12.6.4.13, HexaPDF::Type::OptionalContentGroup

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
NextHexaPDF::Dictionary or HexaPDF::PDFArray or Hash or Arrayfalsenil
StateHexaPDF::PDFArray or Arraytrue[]
PreserveRBTrueClass or FalseClassfalsetrue

Public Instance Methods

add_state_change(type, ocgs)

Adds a state changing sequence to the /State array.

The type argument specifies how the state of the given optional content groups should be changed.


The type of sequence to add, either :on/:ON (for turning the OCGs on) , :off/:OFF (for turning the OCGs off), or :toggle/:Toggle (for toggling the state of the OCGs).


A single optional content group or an array of optional content groups to which the state change defined with type should be applied. The OCGs can be specified via their dictionary or by name which uses the first found OCG with that name.