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.loadDocumentOptions <optional>
The options for the tab to be added Properties
Name Type Argument Description load
boolean <optional>
Whether to load the tab immediately after adding it (default: true) saveCurrent
boolean <optional>
Whether to save the current tab state before adding the new tab (only used when load=true) (default: true) 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", load: true, saveCurrent: 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> getTabs()
-
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 [, saveCurrent])
-
Set the currently open tab in the UI
Parameters:
Name Type Argument Description tabId
number The tab id to set as the current tab saveCurrent
boolean <optional>
Whether to save the current tab state 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 });