# Namespace: TabManager

## UI. TabManager

An instance of TabManager that can be used to edit the open document Tabs **Only Multi-Tab Mode**.

### Example

    WebViewer(...)
     .then(function (instance) {
        instance.UI.TabManager.setActiveTab(0);
      })

### Methods

#### <static> addTab(src [, options])

  Add a new tab to the UI

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `src` | string | File | Blob | Core.Document | Core.PDFNet.PDFDoc |  | The source of the tab to be added (e.g. a URL, a blob, ArrayBuffer, or a File)
  `options` | UI.addTabOptions | <optional> | The options for the tab to be added

  ##### Returns:

  Resolves to the tab id of the newly added tab
  Type
    Promise.<number>

  ##### Example

      WebViewer(...).then(function(instance) {
        instance.UI.TabManager.addTab('http://www.example.com/pdf', {extension: "pdf", setActive: true, saveCurrentActiveTabState: true}); // Add a new tab with the URL http://www.example.com
      });

#### <static> deleteTab(tabId)

  Delete a tab by id in the UI

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tabId` | number | The tab id to be deleted from the tab header

  ##### Returns:

  Type
    void

  ##### Example

      WebViewer(...).then(function(instance) {
        instance.UI.TabManager.deleteTab(0); // Delete tab id 0
      });

#### <static> getActiveTab()

  Get the currently active tab id

  ##### Returns:

  The current tab with the following properties: { id: Number, options: Object, src: string|Blob|File|ArrayBuffer }
  Type
    object

#### <static> getAllTabs()

  Get all the tabs from the UI

  ##### Returns:

  Array of tab objects containing the following properties: { id: Number, options: Object, src: string|Blob|File|ArrayBuffer }
  Type
    Array.<Object>

#### <static> setActiveTab(tabId [, saveCurrentActiveTabState])

  Set the currently open tab in the UI

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `tabId` | number |  | The tab id to set as the current tab
  `saveCurrentActiveTabState` | boolean | <optional> | Whether to save the current tab annotations, scroll position, and zoom level before switching to the new tab (default: true)

  ##### Returns:

  Resolves when the tab is loaded
  Type
    Promise.<void>

  ##### Example

      WebViewer(...).then(function(instance) {
        instance.UI.TabManager.setActiveTab(0, false); // Set to tab id 0 discarding current tab state
      });

#### Search results