class HexaPDF:: Type:: OptionalContentConfiguration
Parent | HexaPDF::Dictionary |
---|
Represents an optional content configuration dictionary.
This dictionary is used for the /D and /Configs entries in the optional content properties dictionary. It configures the states of the OCGs as well as defines how those states may be changed by a PDF processor.
See: PDF2.0 s8.11.4.3
Field Definitions
Name | Type/Allowed Values | Required | Default Value |
---|---|---|---|
Name | String | false | nil |
Creator | String | false | nil |
BaseState | Symbol One of: :ON, :OFF, :Unchanged | false | :ON |
ON | HexaPDF::PDFArray or Array | false | nil |
OFF | HexaPDF::PDFArray or Array | false | nil |
Intent | Symbol or HexaPDF::PDFArray or Array | false | :View |
AS | HexaPDF::PDFArray or Array | false | nil |
Order | HexaPDF::PDFArray or Array | false | nil |
ListMode | Symbol One of: :AllPages, :VisiblePages | false | :AllPages |
RBGroups | HexaPDF::PDFArray or Array | false | nil |
Locked | HexaPDF::PDFArray or Array | false | [] |
Public Instance Methods
Makes the given optional content group visible in an interactive PDF processor’s user interface.
The OCG is always added to the end of the specified path
or, if path
is not specified, the top level.
The optional argument path
specifies the strings or OCGs under which the given OCG should hierarchically be nested. A string is used as a non-selectable label, an OCG reflects an actual nesting of the involved OCGs.
Examples:
configuration.add_ocg_to_ui(ocg) # Add the OCG as top-level item
configuration.add_ocg_to_ui(ocg, path: 'Debug') # Add the OCG under the label 'Debug'
# Add the OCG under the label 'Page1' which is under the label 'Debug'
configuration.add_ocg_to_ui(ocg, path: ['Debug', 'Page1'])
configuration.add_ocg_to_ui(ocg, path: other_ocg) # Add the OCG under the other OCG
Returns true
if the given optional content group is on.
Returns the state (:on
, :off
or nil
) of the optional content group if the state
argument is not given. Otherwise sets the state of the OCG to the given state value (:on
/:ON
or :off
/:OFF
).
The value nil
is only returned if the state is not defined by the configuration dictionary (which may only be the case if the configuration dictionary is not the default configuration dictionary).