PdfOptionalContentConfiguration Class

An optional content configuration (ISO 32000-2, 8.11.4.3): the state of the groups, those the user cannot change, and the groups that behave as radio buttons. The default configuration (/D) gives the state of the groups when the document is opened; the others (/Configs) are alternatives a viewer can offer.

public sealed class PdfOptionalContentConfiguration

Properties

NameDescription
BaseStateGets or sets the state of the groups the configuration does not list (/BaseState). The default is PdfOptionalContentBaseState.On.
CreatorGets or sets the name of the application or the person that created the configuration (/Creator).
DictionaryGets the configuration dictionary.
LockedGroupsGets the groups the user cannot turn on or off (/Locked).
NameGets or sets the name of the configuration (/Name).
RadioButtonGroupsGets the sets of groups that behave as radio buttons (/RBGroups): turning a group of a set on turns the others off.

Gets or sets the state of the groups the configuration does not list (/BaseState). The default is PdfOptionalContentBaseState.On.

public PdfOptionalContentBaseState BaseState { get; set; }

Gets or sets the name of the application or the person that created the configuration (/Creator).

public string? Creator { get; set; }

Property value

string?

Gets the configuration dictionary.

public PdfDictionary Dictionary { get; }

Property value

PdfDictionary

Gets the groups the user cannot turn on or off (/Locked).

public IReadOnlyList<PdfOptionalContentGroup> LockedGroups { get; }

Gets or sets the name of the configuration (/Name).

public string? Name { get; set; }

Property value

string?

Gets the sets of groups that behave as radio buttons (/RBGroups): turning a group of a set on turns the others off.

public IReadOnlyList<IReadOnlyList<PdfOptionalContentGroup>> RadioButtonGroups { get; }

Methods

NameDescription
AddRadioButtonGroup(IEnumerable<PdfOptionalContentGroup>)Adds a set of groups that behave as radio buttons (/RBGroups).
IsVisible(PdfOptionalContentGroup)Indicates whether a group is visible in this configuration: its base state, unless the configuration lists it on or off.
SetLocked(PdfOptionalContentGroup, bool)Locks or unlocks a group (/Locked): the user cannot turn a locked group on or off.
SetVisible(PdfOptionalContentGroup, bool)Sets the state of a group in this configuration (/ON, /OFF).

AddRadioButtonGroup(IEnumerable<PdfOptionalContentGroup>)

PdfOptionalContentConfiguration.cs

Adds a set of groups that behave as radio buttons (/RBGroups).

public void AddRadioButtonGroup(params IEnumerable<PdfOptionalContentGroup> groups)

Parameters

groups IEnumerable<PdfOptionalContentGroup>
The groups.

Exceptions

ArgumentException
A group belongs to another document, or there are fewer than 2 groups.

IsVisible(PdfOptionalContentGroup)

PdfOptionalContentConfiguration.cs

Indicates whether a group is visible in this configuration: its base state, unless the configuration lists it on or off.

public bool IsVisible(PdfOptionalContentGroup group)

Parameters

group PdfOptionalContentGroup
The group.

Returns

bool true when the group is on; true as well for PdfOptionalContentBaseState.Unchanged and a group not listed.

SetLocked(PdfOptionalContentGroup, bool)

PdfOptionalContentConfiguration.cs

Locks or unlocks a group (/Locked): the user cannot turn a locked group on or off.

public void SetLocked(PdfOptionalContentGroup group, bool locked)

Parameters

group PdfOptionalContentGroup
The group.
locked bool
Whether the group is locked.

Exceptions

ArgumentException
The group belongs to another document.

SetVisible(PdfOptionalContentGroup, bool)

PdfOptionalContentConfiguration.cs

Sets the state of a group in this configuration (/ON, /OFF).

public void SetVisible(PdfOptionalContentGroup group, bool visible)

Parameters

group PdfOptionalContentGroup
The group.
visible bool
Whether the group is on.

Exceptions

ArgumentException
The group belongs to another document.