PDF Web Viewer
    Preparing search index...

    Interface IDocumentTabsAPI

    Public API surface for building a custom document tab bar.

    Obtained via the documentTabs property on the IPdfEditorResult returned by PdfEditor(). Available regardless of whether the built-in tab bar is visible.

    const result = await PdfEditor({ container, license, layoutConfig: { tabBar: { enabled: false } } });
    const { tabs$, activeTabId$, switchToTab, closeTab } = result.documentTabs;

    tabs$.subscribe(tabs => renderMyTabBar(tabs));
    interface IDocumentTabsAPI {
        activeTabId$: Observable<string>;
        sideBySideActive$: Observable<boolean>;
        tabs$: Observable<IDocumentTab[]>;
        closeSbsSide(index: 0 | 1): Promise<void>;
        closeTab(tabId: string): Promise<void>;
        getActiveTabId(): string;
        getTabs(): IDocumentTab[];
        isSideBySideActive(): boolean;
        reverseViews(): void;
        separateViews(): Promise<void>;
        setSideBySideMode(enabled: boolean): Promise<void>;
        switchToTab(tabId: string): Promise<void>;
    }
    Index

    Properties

    activeTabId$: Observable<string>

    Emits the active tab ID whenever the active tab changes. Emits null when no tab is active.

    sideBySideActive$: Observable<boolean>

    Emits true when Side-by-Side mode is enabled, false when it is disabled.

    tabs$: Observable<IDocumentTab[]>

    Emits the full, up-to-date list of open tabs whenever it changes. Includes tab name, active state, SBS state and unsaved-changes flag.

    Methods

    • Close one side of the active SBS tab.

      • If the other side has a document: exits SBS mode and keeps that document.
      • If the other side is empty: closes the whole tab.

      Respects unsaved-changes dialogs, identical to the built-in tab bar behaviour.

      Parameters

      • index: 0 | 1

        Visual position: 0 = left, 1 = right

      Returns Promise<void>

    • Close the tab with the given ID.

      Applies the same unsaved-changes confirmation logic as the built-in tab bar: if the document has unsaved changes the user is prompted to save or discard before the tab is closed.

      Parameters

      • tabId: string

      Returns Promise<void>

    • Returns the currently active tab ID, or null if none.

      Returns string

    • Returns the current snapshot of all open tabs.

      Returns IDocumentTab[]

    • Returns true if the active tab is currently in Side-by-Side mode.

      Returns boolean

    • Swap the left and right views in Side-by-Side mode. No-op if SBS is not active.

      Returns void

    • Split the current SBS tab into two independent tabs (one per document currently displayed). No-op if SBS is not active.

      Returns Promise<void>

    • Enable or disable Side-by-Side mode for the active tab.

      Parameters

      • enabled: boolean

        true to enter SBS, false to exit SBS

      Returns Promise<void>

    • Switch to (activate) the tab with the given ID. Handles SBS state restoration for previously visited SBS tabs.

      Parameters

      • tabId: string

      Returns Promise<void>