Click or drag to resize

Context Class

Begin processing a page.
Begin processing given content stream. The content stream may be a Form XObject, Type3 glyph stream, pattern stream or any other content stream.
Sets the Optional Content Group (OCG) context that should be used when rendering the page. This function can be used to selectively render optional content (such as PDF layers) based on the states of optional content groups in the given context.
Sets the Optional Content Group (OCG) context that should be used when rendering the page. This function can be used to selectively render optional content (such as PDF layers) based on the states of optional content groups in the given context.
Gets the current state.
Sets the current ON-OFF state of the optional-content group (OCG) object in a given context.

The OCG::Context object represents an optional-content context in a document, within which document objects such as words or annotations are visible or hidden. The context keeps track of the ON-OFF states of all of the optional-content groups (OCGs) in a document. Content is or is not visible with respect to the OCG states stored in a specific context. Unlike other objects in OCG namespace, the OCG::Context does not correspond to any explicit PDF structure.

Each PDFView has a default context (PDF::GetOCGContext()) that it uses for on-screen drawing and that determines the default state for any drawing. The context has flags that control whether to draw content that is marked as optional, and whether to draw content that is not marked as optional.

When enumerating page content, OCG::Context can be passed as a parameter in ElementReader.Begin() method. When using PDFDraw, PDFRasterizer, or PDFViewCtrl class to render PDF pages use SetOCGContext() method to select an OC context.

There can be more than one Context object, representing different combinations of OCG states. You can change the states of OCGs within any context. You can build contexts with your own combination of OCG states, and issue drawing or enumeration commands using that context. For example, you can pass an optional-content context to ElementReader.Begin(). You can save the resulting state information as part of the configuration (e.g. using Config::SetInit methods), but the context itself has no corresponding PDF representation, and is not saved.

Sets the Optional Content Group (OCG) context that should be used when viewing the document. This function can be used to change the current OCG context. Optional content, such as PDF layers will be selectively rendered based on the states of optional content groups in the given context.
Gets the Optional Content Group (OCG) context associated with this PDFViewCtrl
Inheritance Hierarchy
SystemObject
  pdftron.PDF.OCGContext

Namespace:  pdftron.PDF.OCG
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public sealed class Context : IClosable

Return Value

Type: 
true if this OCG object is in the ON state in a given context, false otherwise.

Return Value

Type: 
the Optional Content Group (OCG) context associated with this PDFViewCtrl, or NULL (i.e. context.IsValid()==false) if there is no OCG context associated with the view. If an OCG context associated with the view, optional content, such as PDF layers will be selectively rendered based on the states of optional content groups in the given context.

The Context type exposes the following members.

Constructors
  NameDescription
Public methodContext(Config)
Create a context object that represents an optional-content state of the document from a given configuration.
Public methodContext(Context)
Copy constructor.
Top
Methods
  NameDescription
Public methodClose
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetNonOCDrawing
Gets the non oc drawing.
Public methodGetOCMode
Gets OC drawing mode
Public methodGetState
Gets the state.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodResetStates
Sets the sates of all OCGs in the context to ON or OFF.
Public methodSetNonOCDrawing
Sets the non-OC status for this context. Content that is not marked as optional content is drawn (or element.IsOCVisible()) when 'draw_non_OC' is true, and not drawn/visible otherwise.
Public methodSetOCDrawMode
Sets the drawing and enumeration type for this context. This type, together with the visibility determined by the OCG and OCMD states, controls whether content that is marked as optional content is drawn or enumerated.
Public methodSetState
Sets the ON-OFF states for the given optional-content group (OCG) in this context.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks
When page processing is completed, make sure to call ElementReader.End().
Remarks
When page processing is completed, make sure to call ElementReader.End().
Remarks
Unlike PDFDraw.SetOCGContext() this method copies the given context. As a result, in order to modify the state of OCG groups in the current context use GetOCGContext() to obtain the currently selected content and then modify states.
See Also