[]
Represents the Optional Content Properties PDF dictionary that can be specified in the document catalog.
public class OptionalContentProperties : PdfDictWrapper, IPdfDict
Gets the collection of alternate optional content configurations.
public OptionalContentConfigurationCollection Configs { get; }
Gets the default optional content configuration.
public OptionalContentConfiguration DefaultConfig { get; }
Gets the GcPdfDocument object that owns this object.
public GcPdfDocument Doc { get; }
Gets the collection of optional content groups.
public OptionalContentGroupCollection Groups { get; }
Gets a value indicating whether the Configs collection is not empty.
public bool HasConfigs { get; }
Gets a value indicating whether this OptionalContentProperties has DefaultConfig property.
public bool HasDefaultConfig { get; }
Gets a value indicating whether the Groups collection is not empty.
public bool HasGroups { get; }
Adds a layer with a specified name.
public OptionalContentGroup AddLayer(string name)
name
stringThe layer name.
The newly created OptionalContentGroup object that defines the new layer.
Clears the content of the current object.
public void Clear()
Returns the OptionalContentGroup by its name.
public OptionalContentGroup GetLayer(string layerName)
layerName
stringThe layer name.
The OptionalContentGroup object or null if not found.
Returns a value indicating whether a layer is ON by default.
public bool GetLayerDefaultState(OptionalContentGroup layer)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
A value indicating whether the layer is ON by default.
Returns a value indicating whether a layer is ON by default. Throws an exception if the layer with the specified name does not exist.
public bool GetLayerDefaultState(string name)
name
stringThe name of the layer.
A value indicating whether the layer is ON by default.
Returns the export state of a layer.
public LayerExportState GetLayerExportState(OptionalContentGroup layer)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
The export state of the layer.
Returns the export state of a layer. Throws an exception if the layer with the specified name does not exist.
public LayerExportState GetLayerExportState(string name)
name
stringThe name of the layer.
The export state of the layer.
Returns the layer initial view state of a layer.
public LayerInitialViewState GetLayerInitialViewState(OptionalContentGroup layer)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
The initial view state of the layer.
Returns the layer initial view state of a layer. Throws an exception if the layer with the specified name does not exist.
public LayerInitialViewState GetLayerInitialViewState(string name)
name
stringThe name of the layer.
The initial view state of the layer.
Returns a value indicating whether a layer is locked.
public bool GetLayerLocked(OptionalContentGroup layer)
layer
OptionalContentGroupThe OptionalContentGroup object defining the layer.
true if layer is locked, false otherwise.
Returns a value indicating whether a layer is locked. Throws an exception if the layer with the specified name does not exist.
public bool GetLayerLocked(string name)
name
stringThe name of the layer.
true if layer is locked, false otherwise.
Returns the print state of a layer.
public LayerPrintState GetLayerPrintState(OptionalContentGroup layer)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
The print state of the layer.
Returns the print state of a layer. Throws an exception if the layer with the specified name does not exist.
public LayerPrintState GetLayerPrintState(string name)
name
stringThe name of the layer.
The print state of the layer.
Removes a specified layer. Note that this method does not remove the content associated with the layer. For content removal, see RemoveLayers(bool, params OptionalContentGroup[]).
public void RemoveLayer(OptionalContentGroup layer)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer to remove.
Removes a layer with a specified name. Throws an exception if the layer with the specified name does not exist. Note that this method does not remove the content associated with the layer. For content removal, see RemoveLayers(bool, params OptionalContentGroup[]).
public void RemoveLayer(string name)
name
stringThe name of the layer to remove.
Removes specified layers, optionally removing content associated with those layers.
public void RemoveLayers(bool removeContent, params OptionalContentGroup[] layers)
removeContent
boolIndicates whether to remove content associated with the specified layers.
layers
OptionalContentGroup[]An array of OptionalContentGroup objects that specify the layers to be removed.
Sets the default state of a layer.
public void SetLayerDefaultState(OptionalContentGroup layer, bool on)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
on
boolIndicates whether the layer is ON (visible) by default.
Sets the default state of a layer. Throws an exception if the layer with the specified name does not exist.
public void SetLayerDefaultState(string name, bool on)
name
stringThe name of the layer.
on
boolIndicates whether the layer is ON (visible) by default.
Sets the export state of a layer.
public void SetLayerExportState(OptionalContentGroup layer, LayerExportState value)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
value
LayerExportStateThe export state.
Sets the export state of a layer. Throws an exception if the layer with the specified name does not exist.
public void SetLayerExportState(string name, LayerExportState value)
name
stringThe name of the layer.
value
LayerExportStateThe export state.
Sets the initial view state of a layer.
public void SetLayerInitialViewState(OptionalContentGroup layer, LayerInitialViewState value)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
value
LayerInitialViewStateThe initial view state.
Sets the initial view state of a layer. Throws an exception if the layer with the specified name does not exist.
public void SetLayerInitialViewState(string name, LayerInitialViewState value)
name
stringThe name of the layer.
value
LayerInitialViewStateThe initial view state.
Sets the locked state of a layer.
public void SetLayerLocked(OptionalContentGroup layer, bool locked)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
locked
boolIndicates whether the layer is locked.
Sets the locked state of a layer. Throws an exception if the layer with the specified name does not exist.
public void SetLayerLocked(string name, bool value)
name
stringThe name of the layer.
value
boolIndicates whether the layer is locked.
Sets the print state of a layer.
public void SetLayerPrintState(OptionalContentGroup layer, LayerPrintState value)
layer
OptionalContentGroupThe OptionalContentGroup object that specifies the layer.
value
LayerPrintStateThe print state of the layer.
Sets the print state of a layer. Throws an exception if the layer with the specified name does not exist.
public void SetLayerPrintState(string name, LayerPrintState value)
name
stringThe name of the layer.
value
LayerPrintStateThe print state of the layer.