Class Index

Classes


Class PDFNet.OCGContext

PDFNet.OCGContext

Class Summary
Constructor Attributes Constructor Name and Description
 

The OCGContext object represents an optional-content context in a document, within which document objects such as words or annotations are visible or hidden.

Method Summary
Method Attributes Method Name and Description
 
copy()
Copy Constructor
<static>  
PDFNet.OCGContext.createFromConfig(cfg)
create a context object that represents an optional-content state of the document from a given configuration.
 
Frees the native memory of the object.
 
 
 
getState(grp)
 
resetStates(all_on)
sets the sates of all OCGs in the context to ON or OFF.
 
setNonOCDrawing(draw_non_OC)
Sets the non-OC status for this context.
 
setOCDrawMode(oc_draw_mode)
sets the drawing and enumeration type for this context.
 
setState(grp, state)
sets the ON-OFF states for the given optional-content group (OCG) in this context.
Class Detail
PDFNet.OCGContext(id)

The OCGContext 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 OCGContext 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, OCGContext can be passed as a parameter in ElementReader.Begin() method. When using PDFDraw, PDFRasterizer, or PDFView class to render PDF pages use ( PDFDraw::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.

Parameters:
id
Method Detail
{OCGContext} copy()
Copy Constructor
Returns:
{OCGContext} A promise that resolves to an object of type: "OCGContext" (generated documentation)

<static> {OCGContext} PDFNet.OCGContext.createFromConfig(cfg)
create a context object that represents an optional-content state of the document from a given configuration.
Parameters:
{OCGConfig} cfg
A configuration from which to take initial OCG states.
Returns:
{OCGContext} A promise that resolves to an object of type: "OCGContext" (generated documentation)

destroy()
Frees the native memory of the object.

{boolean} getNonOCDrawing()
Returns:
{boolean} A promise that resolves to the non-OC status for this context. The flag indicates whether the content that is not marked as optional should be treated as visible. For more information, please see SetNonOCDrawing().

{number} getOCMode()
Return value enum:
PDFNet.OCGContext.OCDrawMode = {
	e_VisibleOC : 0
	e_AllOC : 1
	e_NoOC : 2
}
Returns:
{number} A promise that resolves to the drawing and enumeration type for this context. For more information, please see SetOCMode() and OCG::Context::OCDrawMode.

{boolean} getState(grp)
Parameters:
{OCG} grp
The optional-content group (OCG) that is queried.
Returns:
{boolean} A promise that resolves to the ON-OFF states (true or false) for the given optional-content group (OCG) in this OC context.

resetStates(all_on)
sets the sates of all OCGs in the context to ON or OFF.
Parameters:
{boolean} all_on
A flag used to specify whether the OCG states should be set to ON (if true), or OFF (if false).

setNonOCDrawing(draw_non_OC)
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.
Parameters:
{boolean} draw_non_OC
A flag specifying whether the content that is not marked as optional should be treated as visible.

setOCDrawMode(oc_draw_mode)
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.
Parameters:
{number} oc_draw_mode
A flag specifying the visibility of optional content.

setState(grp, state)
sets the ON-OFF states for the given optional-content group (OCG) in this context.
Parameters:
{OCG} grp
The optional-content group (OCG) that is queried.
{boolean} state
true for 'ON' and false for 'OFF'.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 09 2016 14:32:40 GMT-0700 (PDT)