> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/get-started/faq/widget-tab-ordering.md).

# Form Widget Tab Ordering

World's #1 PDF SDK Library for Web, Mobile, Server, Desktop

In PDF documents the tabbing order for forms is defined by the order of form widget annotations in the annotation list. Some PDFs will have a tree structure that defines how certain elements and widgets in the document are ordered and if this structure exists then that will define the form tab order instead.

It can be quite expensive to parse through the entire structure (especially with a long and complex document) so by default WebViewer's tab order is based on the annotation list order.

Starting in WebViewer 10.3 you are able to have WebViewer use the order of the "logical structure" tree to define the widget tab order.

## Enabling widget tab ordering

**This requires the full API.**

To enable structure parsing and ensuring the widget order is respected, you can enable this via [`AnnotationManager.enableWidgetTabOrdering`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#enableWidgetTabOrdering).

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
WebViewer({
  path: 'path/to/lib',
  fullAPI: true,
  ...
})
  .then((instance) => {
    const { annotationManager } = instance.Core;
    // Starts parsing the structure and ordering the widgets
    annotationManager.enableWidgetTabOrdering();
  });
```

{% endcode %}
{% endtab %}
{% endtabs %}

[AnnotationManager.enableWidgetTabOrdering](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#enableWidgetTabOrdering)

To disable it, you can use [`AnnotationManager.disableWidgetTabOrdering`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#disableWidgetTabOrdering) instead.

## Types of widget ordering

There are various types of widget orderings that can be set on widgets on a form as defined by the PDF specification. By default, the ordering of the widgets uses `Structure` ordering. However, you can use `Row` or `Column` ordering as well. These are supported by WebViewer.

You can find the [`TabbingOrders`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#.TabbingOrders) constant with these values on the `AnnotationManager` class itself.

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
instance.Core.AnnotationManager.TabbingOrders.STRUCTURE;
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Getting the widget tab order

You can get the tab order being used using [`AnnotationManager.getTabOrder`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#getTabOrder). This will provide a value that matches one of the ones found in the [`TabbingOrders`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#.TabbingOrders) constant mentioned above.

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
if (annotationManager.getTabOrder() === instance.Core.AnnotationManager.TabbingOrders.STRUCTURE) {
  // Do something...
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

[AnnotationManager.getTabOrder](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#getTabOrder)

## Changing the widget tab order

You can also change the tab order of widget with [`AnnotationManager.setTabOrder`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#setTabOrder). This function expects a value found in the [`TabbingOrders`](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#.TabbingOrders) constant mentioned above. This will update the loaded document with the newly set widget ordering.

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// Order widgets from left to right, top to bottom
annotationManager.setTabOrder(instance.Core.AnnotationManager.TabbingOrders.ROW);
```

{% endcode %}
{% endtab %}
{% endtabs %}

[AnnotationManager.setTabOrder](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#setTabOrder)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/web/get-started/faq/widget-tab-ordering.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
