# Enums and constants

Frozen objects whose values you compare against, and the constants the package exports so you never restate a default.

## SDKMode

What the viewer is for (`PDFViewerConfig.mode`, see [SDKMode and the resting tool](https://kernstra.com/docs/web-sdk/config/mode)). The mode sets which tools exist at all, and the `tools` map turns individual tools off within it — it cannot add a tool the mode does not offer. Select, Pan and Search exist in every mode; Sign also in `'form-fill'`; every other tool in `'full'` only. `SDKMode` is a frozen object whose values are these strings, so `mode: 'view-only'` and `mode: SDKMode.VIEW_ONLY` are the same thing. A `mode` that names none of the three falls back to `'full'` with a console warning. Print and download stay available in every mode, and so does the rest of the programmatic API; in `'view-only'` every field is read-only, so `doc.forms.setValues()` rejects each field with the reason `read_only`.

| Member | Value | Description |
| --- | --- | --- |
| `VIEW_ONLY` | `'view-only'` | A reader. Pan and Select, the panels (pages, outline, attachments, signatures), search from the keyboard, print and download. Form fields show their values and cannot be filled. No tools, no undo. |
| `FORM_FILL` | `'form-fill'` | Complete a document. Form fields and signatures are interactive; the toolbar carries the panel toggles and actions only, with no authoring tools. |
| `FULL` | `'full'` | **Default.** Everything: Pan, Select, undo/redo, Add Text, Edit Text, Sign, Check, Cross, Dot, Arrow, Draw, Line, Rectangle, Ellipse, Polygon, Polyline, Erase, Highlight, Text Highlight, Text Box, Image, Stamp, Link, Note, Search, Manage Pages, Security. Turn off what you do not need. |

## FormFieldType

A field's `type` in [`FormFieldInfo`](https://kernstra.com/docs/web-sdk/api/types#ty-formfieldinfo): `FormFieldType.TEXT` … `SIGNATURE`, or the values themselves. A frozen object; its values are the union `FormFieldInfo['type']`.

| Member | Value | Description |
| --- | --- | --- |
| `TEXT` | `'text'` | A text field, comb and multiline fields included. |
| `CHECKBOX` | `'checkbox'` | A check box. |
| `RADIO` | `'radio'` | A radio group. |
| `DROPDOWN` | `'dropdown'` | A dropdown (combo box). |
| `LISTBOX` | `'listbox'` | A list box, single- or multi-select. |
| `SIGNATURE` | `'signature'` | A signature field. Left out of `doc.forms.getValues()`; `doc.forms.setValues()` rejects it with `unsupported_type` — it is signed on screen, or through `callbacks.onSignatureRequest`. |

## SetFieldRejection

Why `doc.forms.setValues()` refused a value, in each [`SetFieldResult`](https://kernstra.com/docs/web-sdk/api/types#ty-setfieldresult): compare against `SetFieldRejection.UNKNOWN_FIELD`, `.READ_ONLY`, `.INVALID_VALUE`, `.UNSUPPORTED_TYPE`. The values are lowercase strings; their union is `SetFieldRejectionReason`. Nothing is thrown for a field: rejections are reported here.

| Member | Value | Description |
| --- | --- | --- |
| `UNKNOWN_FIELD` | `'unknown_field'` | No field has that fully qualified name — including fields past the 16 384 widgets a document is read as. |
| `READ_ONLY` | `'read_only'` | The field is read-only: its own flag, the document's permissions forbidding filling, a certification that allows no changes, or the viewer's `'view-only'` mode. |
| `INVALID_VALUE` | `'invalid_value'` | The value is not one the field takes: an option it does not have, an array of more than one for a field that takes one, a value of the wrong kind, a format the field does not accept. |
| `UNSUPPORTED_TYPE` | `'unsupported_type'` | The field cannot be set from code: a signature field, or a password field without a viewer (a file never keeps a password field's text). |

## Constants

| Name | Type | Description |
| --- | --- | --- |
| `ErrorCode` | frozen object; `ErrorCodeValue` is its union | Machine-readable error codes — the 20 codes on [Error handling](https://kernstra.com/docs/web-sdk/api/errors), so you can exhaustively switch on `err.code` without hardcoding strings. |
| `DEFAULT_CONFIG` | `ResolvedPDFViewerConfig` | Every default the viewer applies. Read it rather than restating defaults in your own code. Made of the `Resolved*Config` parts — see [ResolvedPDFViewerConfig](https://kernstra.com/docs/web-sdk/api/types#ty-resolvedpdfviewerconfig). |
| `TOOL_NAMES` | `readonly ToolName[]` (frozen) | Every tool name, in the toolbar's order — for a tool picker of your own, or `(TOOL_NAMES as readonly string[]).includes(name)` to check a name from your own configuration before offering it. See [ToolName](https://kernstra.com/docs/web-sdk/api/types#ty-toolname). |
| `PANEL_TOOL_NAMES` | `readonly ToolName[]` (frozen) | The two names in `TOOL_NAMES` that are panels, `'search'` and `'managePages'`: activating one leaves `activeTool` as it was, so a host's buttons do not mark them pressed from `toolChanged`. |
| `REVIEW_STATUSES` | `readonly ReviewStatus[]` (frozen) | The review statuses `doc.annotations.setStatus()` takes — `'accepted'`, `'rejected'`, `'cancelled'`, `'completed'`, `'none'` — in the order the panel's menu offers them. |
| `SIGNATURE_FONTS` | `readonly SignatureFont[]` (frozen) | The Type tab's default faces — Standard, Script, Elegant, Casual, Classic, each a `{ family, label }`; spread into [`tools.sign.fonts`](https://kernstra.com/docs/web-sdk/config/tools/sign-fonts) to add your own beside them. |
| `BUILTIN_FONTS` | `readonly Readonly<FontDefinition>[]` (frozen) | The font catalog — the 3 standard PDF fonts (`helvetica`, `times`, `courier`) and the bundled fonts, every one SIL OFL 1.1 — for building your own font picker. Each entry is a [FontDefinition](https://kernstra.com/docs/web-sdk/api/types#ty-fontdefinition); `Kernstra.assetDigests.fonts` is keyed by `BUILTIN_FONTS[i].id`. |
| `EN_STRINGS` | `UIStrings` | Every UI string key with its English text — the table a translation overrides (`Partial<UIStrings>`), see [Locale](https://kernstra.com/docs/web-sdk/config/locale). `UIStringKey` is `keyof typeof EN_STRINGS`. |
| `ICONS` | `Readonly<Record<IconName, string>>` | Every built-in icon's SVG markup by name, for reusing an SDK icon in your own chrome; the same names key [`toolbar.icons`](https://kernstra.com/docs/web-sdk/config/toolbar/icons) replacements. |
| `FormType` | type: `'none' \| 'acroform' \| 'xfa' \| 'xfa-foreground'` | A type, not a value: compare against `doc.forms.type()`. Only AcroForm fields are interactive; `xfa-foreground` is XFA laid over an AcroForm, whose AcroForm part fills. |
