Form Widget Tab Ordering

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.

JavaScript

1WebViewer({
2 path: 'path/to/lib',
3 fullAPI: true,
4 ...
5})
6 .then((instance) => {
7 const { annotationManager } = instance.Core;
8 // Starts parsing the structure and ordering the widgets
9 annotationManager.enableWidgetTabOrdering();
10 });

To disable it, you can use AnnotationManager.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 constant with these values on the AnnotationManager class itself.

JavaScript

1instance.Core.AnnotationManager.TabbingOrders.STRUCTURE;

Getting the widget tab order

You can get the tab order being used using AnnotationManager.getTabOrder. This will provide a value that matches one of the ones found in the TabbingOrders constant mentioned above.

JavaScript

1if (annotationManager.getTabOrder() === instance.Core.AnnotationManager.TabbingOrders.STRUCTURE) {
2 // Do something...
3}

Changing the widget tab order

You can also change the tab order of widget with AnnotationManager.setTabOrder. This function expects a value found in the TabbingOrders constant mentioned above. This will update the loaded document with the newly set widget ordering.

JavaScript

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

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales