# PDFViewer.activateTool()

```ts
activateTool(tool: ToolName): Promise<void>
```

Activate a tool (again: put it away, back to the resting tool). Edit Text left with edits pending writes them first; a refused write keeps it, and the promise resolves with it still active. Needs the tool's license feature; refused for a tool the license does not cover.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `tool` | `ToolName` | One of the 26 names of `TOOL_NAMES`, in the toolbar's order. Two of them are panels rather than tools: `'search'` and `'managePages'` open their panel and resolve, and `activeTool` stays what it was — `openPanel('search')` / `openPanel('pages')` are the same action by their own name. The exported `PANEL_TOOL_NAMES` names those two, so a host that marks its buttons pressed from `activeTool` or `toolChanged` need not hard-code them. |

Returns `Promise<void>`

Throws:

- `INVALID_ARGUMENT` for a name that is no tool or a tool that is off — see [isToolEnabled](https://kernstra.com/docs/web-sdk/api/pdfviewer/istoolenabled).
- `FEATURE_NOT_LICENSED` for one the license does not cover.
- `PERMISSION_DENIED` for one the document's permissions forbid — see [toolBlockedReason](https://kernstra.com/docs/web-sdk/api/pdfviewer/toolblockedreason).
- `UNKNOWN_ERROR` (the cause as its `cause`; or the tool's own `SDKError`) for a tool that could not start — nothing of it stays, and the viewer goes back to the resting tool.
- `INVALID_STATE` after `destroy()`.

```ts
await viewer.activateTool('highlight');
await viewer.activateTool('highlight'); // again: back to the resting tool
```

Part of [PDFViewer](https://kernstra.com/docs/web-sdk/api/pdfviewer) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/pdfviewer/activatetool
