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.loadDocumentOptions <optional>
The options for the tab to be added
Properties
Name Type Argument Description
setActive boolean <optional>
Whether to set the new tab as active immediately after adding it (default: true)
saveCurrentActiveTabState boolean <optional>
Whether to save the current tab annotations, scroll position, and zoom level before adding the new tab (only used when setActive=true) (default: true)
extension string <optional>
The extension of the file. If file is a blob/file object or a URL without an extension then this is necessary so that WebViewer knows what type of file to load.
filename string <optional>
Filename of the document, which is used when downloading the PDF.
customHeaders object <optional>
An object of custom HTTP headers to use when retrieving the document from the specified url.
webViewerServerCustomQueryParameters object <optional>
An object of custom query parameters to be appended to every WebViewer Server request.
documentId string <optional>
Unique id of the document.
withCredentials boolean <optional>
Whether or not cross-site requests should be made using credentials.
cacheKey string <optional>
A key that will be used for caching the document on WebViewer Server.
officeOptions object <optional>
An object that contains the options for an Office document.
rasterizerOptions object <optional>
An object that contains the rasterizer options for WebViewer Server.
officeOptions.templateValues Core.TemplateData <optional>
If set, will perform template replacement with the data specified by this parameter.
officeOptions.templateOptions Core.TemplateOptions <optional>
If set, it will interpret the office document as a template document and compile all of the template tags in the document using the provided options.
officeOptions.doTemplatePrep boolean <optional>
If set, it will interpret the office document as a template document and compile all of the template tags in the document.
officeOptions.disableBrowserFontSubstitution boolean <optional>
By default, office viewing takes a lightweight approach to font substitution, allowing the browser to select fonts when they are not embedded in the document itself. While this means that WebViewer has access to all the fonts on the user's system, it also means that an office document may have a different "look" on different systems (depending on the fonts available) and when it is converted to PDF (as the PDF conversion routine cannot obtain low-level access to user fonts, for security reasons). disableBrowserFontSubstitution prevents this browser substitution, forcing the WebViewer backend to handle all fonts. This means that viewing and conversion to PDF will be 100% consistent from system-to-system, at the expense of a slightly slower initial viewing time and higher bandwidth usage. Using https://docs.apryse.com/documentation/web/faq/self-serve-substitute-fonts/ along with this option allows you to fully customize the substitution behaviour for all office files.
officeOptions.formatOptions object <optional>
An object that contains formatting options for an Office document. Same options as allowed here Core.PDFNet.Convert.OfficeToPDFOptions.
Properties
Name Type Argument Description
hideTotalNumberOfPages boolean <optional>
If true will hide total number of pages from page number labels (i.e, Page 1, Page 2, vs Page 1 of 2, Page 2 of 2)
applyPageBreaksToSheet boolean <optional>
If true will split Excel worksheets into pages so that the output resembles print output.
displayChangeTracking boolean <optional>
If true will display office change tracking markup present in the document (i.e, red strikethrough of deleted content and underlining of new content). Otherwise displays the resolved document content, with no markup. Defaults to true.
officeOptions.formatOptions.displayHiddenText boolean <optional>
If true will display hidden text in document. Otherwise hidden text will not be shown. Defaults to false.
options.officeOptions.formatOptions.excelDefaultCellBorderWidth number <optional>
Cell border width for table cells that would normally be drawn with no border. In units of points. Can be used to achieve a similar effect to the "show gridlines" display option within Microsoft Excel.
options.officeOptions.formatOptions.excelMaxAllowedCellCount number <optional>
An exception will be thrown if the number of cells in an Excel document is above the value. Used for early termination of resource intensive documents. Setting this value to 250000 will allow the vast majority of Excel documents to convert without issue, while keeping RAM usage to a reasonable level. By default there is no limit to the number of allowed cells.
options.officeOptions.formatOptions.locale string <optional>
Sets the value for Locale in the options object ISO 639-1 code of the current system locale. For example: 'en-US', 'ar-SA', 'de-DE', etc.
options.enableOfficeEditing boolean <optional>
If true, will load docx files with editing capabilities.
options.password string <optional>
A string that will be used to as the password to load a password protected document.
options.onError function <optional>
A callback function that will be called when error occurs in the process of loading a document. The function signature is `function(e) {}`
options.xodOptions object <optional>
An object that contains the options for a XOD document.
options.xoddecrypt boolean <optional>
Function to be called to decrypt a part of the XOD file. For default XOD AES encryption pass Core.Encryption.decrypt.
options.xoddecryptOptions boolean <optional>
An object with options for the decryption e.g. {p: "pass", type: "aes"} where is p is the password.
options.xodstreaming boolean <optional>
A boolean indicating whether to use http or streaming PartRetriever, it is recommended to keep streaming false for better performance. https://docs.apryse.com/documentation/web/guides/streaming-option/.
options.xodazureWorkaround boolean <optional>
Whether or not to workaround the issue of Azure not accepting range requests of a certain type. Enabling the workaround will add an extra HTTP request of overhead but will still allow documents to be loaded from other locations.
options.xodstartOffline boolean <optional>
Whether to start loading the document in offline mode or not. This can be set to true if the document had previously been saved to an offline database using WebViewer APIs. You'll need to use this option to load from a completely offline state.
Returns:
Resolves to the tab id of the newly added tab
Type
Promise.<number>
Example
WebViewer(...).then(function(instance) {
  // Adding a new tab with the URL http://www.example.com
  instance.UI.TabManager.addTab(
     'http://www.example.com/pdf',
     {
       extension: "pdf",
       filename: 'Example',
       withCredentials: true,
       setActive: true,
       saveCurrentActiveTabState: true
     }
   );
});

<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> disableDeleteTabWarning()

Disable the warning when deleting a tab in multi-tab mode
Example
WebViewer(...)
  .then(function (instance) {
    instance.UI.TabManager.disableDeleteTabWarning();
  });

<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
});