[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.Layers.ViewState

Class ViewState

Namespace
GrapeCity.Documents.Pdf.Layers
Assembly
GcDocs.Pdf.dll

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:

  • The transient state of optional content (e.g. the user may have turned a layer's visibility on or off).
  • The current operation (e.g. view or print).
This class is used to specify the target context for operations that work with document content, so that only the relevant content is processed. Note that an instance of this class is not automatically updated if the document content (e.g. layers) changes. Use the Reset() method to reset the view state to its initial state.
public class ViewState
Inheritance
object
ViewState
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

ViewState(GcPdfDocument, bool)

Initializes a new instance of the ViewState class.

public ViewState(GcPdfDocument doc, bool ignoreLayersState = false)

Parameters

doc GcPdfDocument

The document for which this instance is created.

ignoreLayersState bool

Indicates whether to ignore the persisted state of the layers, assuming that all layers are visible.

Fields

Doc

The GcPdfDocument for which this ViewState was created.

public readonly GcPdfDocument Doc

Field Value

GcPdfDocument

Properties

CurrentConfiguration

public OptionalContentConfiguration CurrentConfiguration { get; }

Property Value

OptionalContentConfiguration

IgnoreLayersState

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; }

Property Value

bool

Mode

Gets or sets the document view mode.

public ViewState.ViewMode Mode { get; set; }

Property Value

ViewState.ViewMode

Zoom

Gets or sets the document zoom value (1 is actual size, no zoom).

public float Zoom { get; set; }

Property Value

float

Methods

ApplyConfiguration(OptionalContentConfiguration)

Applies the specified configuration to this view state.

public void ApplyConfiguration(OptionalContentConfiguration configuration)

Parameters

configuration OptionalContentConfiguration

The OptionalContentConfiguration object.

GetLayerUIState(OptionalContentGroup)

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:

  • true: the user explicitly made layer visible.
  • false: the user explicitly made layer hidden.
  • null: the user did not change the visibility of layer.
public bool? GetLayerUIState(OptionalContentGroup layer)

Parameters

layer OptionalContentGroup

The target layer.

Returns

bool?

The state of the layer.

GetLayerUIState(string)

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:

  • true: the user explicitly made the layer visible.
  • false: the user explicitly made the layer hidden.
  • null: the user did not change the visibility of the layer.
public bool? GetLayerUIState(string layerName)

Parameters

layerName string

The name of the target layer.

Returns

bool?

The state of the layer.

IsLayerActive(object, ViewMode)

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)

Parameters

layer object

The layer to check.

mode ViewState.ViewMode

The target view mode.

Returns

bool

true if the layer is active, false otherwise.

IsLayerActive(object)

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)

Parameters

layer object

The layer to check.

Returns

bool

true if the layer is active, false otherwise.

IsLayerExportable(object)

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)

Parameters

layer object

The layer to check.

Returns

bool

true if the layer is exportable, false otherwise.

IsLayerPrintable(object)

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)

Parameters

layer object

The layer to check.

Returns

bool

true if the layer is printable, false otherwise.

IsLayerVisible(object)

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)

Parameters

layer object

The layer to check.

Returns

bool

true if the layer is visible, false otherwise.

Reset()

Resets this ViewState to its initial state.

public void Reset()

SetLayersUIState(bool?, params object[])

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:

  • true: the user explicitly made the layers visible.
  • false: the user explicitly made the layers hidden.
  • null: the user did not change the visibility of the layers.
public void SetLayersUIState(bool? state, params object[] layers)

Parameters

state bool?

The desired state of the layer.

layers object[]

The array of layer names or OptionalContentGroup objects.

SetLayersUIStateExcept(bool?, params object[])

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:

  • true: the user explicitly made all layers (except the specified ones) visible.
  • false: the user explicitly made all layers (except the specified ones) hidden.
  • null: the user did not change the visibility of the layers.
public void SetLayersUIStateExcept(bool? state, params object[] layers)

Parameters

state bool?

The desired state of the layer.

layers object[]

The array of layer names or OptionalContentGroup objects to be excluded.

SetLayerUIState(OptionalContentGroup, bool?)

Sets the visibility of an optional content group (layer) in the context of an end-user UI. The state is interpreted as follows:

  • true: the user explicitly made layer visible.
  • false: the user explicitly made layer hidden.
  • null: the user did not change the visibility of layer.
public void SetLayerUIState(OptionalContentGroup layer, bool? state)

Parameters

layer OptionalContentGroup

The target layer.

state bool?

The desired state of the layer.

SetLayerUIState(string, bool?)

Sets the visibility of an optional content group (layer) in the context of an end-user UI. The state is interpreted as follows:

  • true: the user explicitly made layerName visible.
  • false: the user explicitly made layerName hidden.
  • null: the user did not change the visibility of layerName.
public void SetLayerUIState(string layerName, bool? state)

Parameters

layerName string

The name of the target layer.

state bool?

The desired state of the layer.