[]
Represents the view state of a PDF document.
The presentation of a PDF document may depend on the context that is determined by the current environment and is not persisted in the PDF itself. This includes:
public class ViewState
Initializes a new instance of the ViewState class.
public ViewState(GcPdfDocument doc, bool ignoreLayersState = false)
doc GcPdfDocumentThe document for which this instance is created.
ignoreLayersState boolIndicates whether to ignore the persisted state of the layers, assuming that all layers are visible.
The GcPdfDocument for which this ViewState was created.
public readonly GcPdfDocument Doc
Gets the OptionalContentConfiguration specified in the last ApplyConfiguration(OptionalContentConfiguration) method call.
public OptionalContentConfiguration CurrentConfiguration { get; }
Gets or sets a value indicating whether all layers' state should be ignored and all layers should be considered visible.
public bool IgnoreLayersState { get; set; }
Gets or sets the document view mode.
public ViewState.ViewMode Mode { get; set; }
Gets or sets the document zoom value (1 is actual size, no zoom).
public float Zoom { get; set; }
Applies the specified configuration to this view state.
public void ApplyConfiguration(OptionalContentConfiguration configuration)
configuration OptionalContentConfigurationThe OptionalContentConfiguration object.
Gets the visibility state of an optional content group (layer) in the context of an end-user UI The return value is interpreted as follows:
layer visible.layer hidden.layer.public bool? GetLayerUIState(OptionalContentGroup layer)
layer OptionalContentGroupThe target layer.
The state of the layer.
Gets the visibility state of an optional content group (layer) in the context of an end-user UI The return value is interpreted as follows:
public bool? GetLayerUIState(string layerName)
layerName stringThe name of the target layer.
The state of the layer.
Checks whether a layer is active in a specified view mode. The target layer can be specified as an OptionalContentGroup, an OptionalContentMembership or a string representing the name of the layer.
public bool IsLayerActive(object layer, ViewState.ViewMode mode)
true if the layer is active, false otherwise.
Checks whether a layer is active in the view mode specified by the Mode property. The target layer can be specified as an OptionalContentGroup, an OptionalContentMembership or a string representing the name of the layer.
public bool IsLayerActive(object layer)
layer objectThe layer to check.
true if the layer is active, false otherwise.
Checks whether a layer is visible when the document is exported. The target layer can be specified as an OptionalContentGroup, an OptionalContentMembership or a string representing the name of the layer.
public bool IsLayerExportable(object layer)
layer objectThe layer to check.
true if the layer is exportable, false otherwise.
Checks whether a layer is visible when the document is printed. The target layer can be specified as an OptionalContentGroup, an OptionalContentMembership or a string representing the name of the layer.
public bool IsLayerPrintable(object layer)
layer objectThe layer to check.
true if the layer is printable, false otherwise.
Checks whether a layer is visible when the document is viewed. The target layer can be specified as an OptionalContentGroup, an OptionalContentMembership or a string representing the name of the layer.
public bool IsLayerVisible(object layer)
layer objectThe layer to check.
true if the layer is visible, false otherwise.
Resets this ViewState to its initial state.
public void Reset()
Sets the visibility of one or more layers in the context of an end-user UI.
The layers array can contain layer names (strings) or OptionalContentGroup references.
The state is interpreted as follows:
public void SetLayersUIState(bool? state, params object[] layers)
state bool?The desired state of the layer.
layers object[]The array of layer names or OptionalContentGroup objects.
Sets the visibility of all layers except those listed in the layers array, in the context of an end-user UI.
The layers array can contain layer names (strings) or OptionalContentGroup references.
The state is interpreted as follows:
public void SetLayersUIStateExcept(bool? state, params object[] layers)
state bool?The desired state of the layer.
layers object[]The array of layer names or OptionalContentGroup objects to be excluded.
Sets the visibility of an optional content group (layer) in the context of an end-user UI.
The state is interpreted as follows:
layer visible.layer hidden.layer.public void SetLayerUIState(OptionalContentGroup layer, bool? state)
layer OptionalContentGroupThe target layer.
state bool?The desired state of the layer.
Sets the visibility of an optional content group (layer) in the context of an end-user UI.
The state is interpreted as follows:
layerName visible.layerName hidden.layerName.public void SetLayerUIState(string layerName, bool? state)
layerName stringThe name of the target layer.
state bool?The desired state of the layer.