FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
StateHandlerManager Class Reference

Public Member Functions

 get (name)
 Get state handler by name. More...
 
 getCurrentStates ()
 Get current state handler. More...
 
 getStateHandlerConfig (stateHandlerName)
 Get state handler config by name. More...
 
 mergeStateHandlerConfig (stateHandlerName, stateHandlerConfig)
 Unlike the setStateHandlerConfig method, this method doesn't overwrite the last config each time it is called, but overwrites a portion of properties you passed in. More...
 
 register (StateHandler)
 Register state handler. More...
 
 setStateHandlerConfig (stateHandlerName, stateHandlerConfig)
 Set the state-handler config by name, this method will overwrite the existing config, the config may take effect the next time you switch to the state-handler. More...
 
 switchTo (name, params)
 Switch to state handler. More...
 

Detailed Description

Member Function Documentation

◆ get()

StateHandlerManager::get (   name)
inline

Get state handler by name.

Parameters
namestring -
Returns
new<T extends IStateHandler>(pdfViewer:PDFViewer)=>T - Returns HandStateHandler by default

◆ getCurrentStates()

StateHandlerManager::getCurrentStates ( )
inline

Get current state handler.

Returns
new<T extends IStateHandler>(pdfViewer:PDFViewer)=>T -

◆ getStateHandlerConfig()

StateHandlerManager::getStateHandlerConfig (   stateHandlerName)
inline

Get state handler config by name.

Parameters
stateHandlerNameSTATE_HANDLER_NAMES - The state handler name.
Returns
StateHandlerConfig|undefined - Returns undefined if no config is set.
Since
9.0.0

◆ mergeStateHandlerConfig()

StateHandlerManager::mergeStateHandlerConfig (   stateHandlerName,
  stateHandlerConfig 
)
inline

Unlike the setStateHandlerConfig method, this method doesn't overwrite the last config each time it is called, but overwrites a portion of properties you passed in.

Parameters
stateHandlerNameSTATE_HANDLER_NAMES - The state handler name.
stateHandlerConfigPartial<StateHandlerConfig> - The new config object.
Since
9.0.0
Returns
void -

◆ register()

StateHandlerManager::register (   StateHandler)
inline

Register state handler.

Parameters
StateHandlernew<T extends IStateHandler>(pdfViewer:PDFViewer)=>T -

◆ setStateHandlerConfig()

StateHandlerManager::setStateHandlerConfig (   stateHandlerName,
  stateHandlerConfig 
)
inline

Set the state-handler config by name, this method will overwrite the existing config, the config may take effect the next time you switch to the state-handler.

Note
The effective timing of each config item is different, please refer to the documentation of each properties of StateHandlerConfig .
Parameters
stateHandlerNameSTATE_HANDLER_NAMES - The state handler name.
stateHandlerConfigStateHandlerConfig - The new config object.
Since
9.0.0
Returns
void -

◆ switchTo()

StateHandlerManager::switchTo (   name,
  params 
)
inline

Switch to state handler.

Note
If encounter error, it will switch to HandStateHandler.
Parameters
namestring - Specifies the state handler's name. Refer to STATE_HANDLER_NAMES
paramsStampStateHandlerParams|Record<string, string>|undefined - Set state handler's parameters. could be StampStateHandlerParams
See also
STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_STAMP
async function example (pdfViewer) {
var handlerManager = await pdfViewer.getStateHandlerManager();
await handlerManager.switchTo(PDFViewCtrl.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_STAMP, {
category: 'Static',
name: 'Void'
});
}
STATE_HANDLER_NAMES

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.