| FoxitPDFSDKforWeb v11.1.0 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
StateHandlerManager Class Reference
PDFViewCtrl » stateHandler

## 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

IStateHandler's State Manager

See also
  PDFViewer.getStateHandlerManager

## Member Function Documentation

## ◆ get()

StateHandlerManager::get | ( |  | name | ) |
| inline

Get state handler by name.

Parameters

  name | string -

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

  stateHandlerName | STATE_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

  stateHandlerName | STATE_HANDLER_NAMES - The state handler name.
  stateHandlerConfig | Partial<StateHandlerConfig> - The new config object.

Since
  9.0.0

Returns
  void -

## ◆ register()

StateHandlerManager::register | ( |  | StateHandler | ) |
| inline

Register state handler.

Parameters

  StateHandler | new<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

  stateHandlerName | STATE_HANDLER_NAMES - The state handler name.
  stateHandlerConfig | StateHandlerConfig - 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

  name | string - Specifies the state handler's name. Refer to STATE_HANDLER_NAMES
  params | StampStateHandlerParams|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

@2026 Foxit Software Incorporated. All rights reserved.