Side-by-side UI may not appear, only shows a single document.

WebViewer Version: WebViewer 11.12

Are you using the WebViewer server? No
Is your issue related to a front-end framework? Yes

textstyle08

We are integrating MultiViewer (side-by-side) mode in a React app using `@pdftron/webviewer` 11.12. When `sideBySideMode` is enabled with two documents, we call `UI.enterMultiViewerMode()` and then load each PDF into `Core.getDocumentViewers()`. The side-by-side UI does not appear correctly , It shown side -by-side around 1 second and then only a single document is shown. Console reports: `MultiViewerMode requires exactly 2 viewers. Found 1.`

Relevant code

// Enter side-by-side
UI.enterMultiViewerMode()

// Load documents (runs right after enterMultiViewerMode)
const documentViewers = Core.getDocumentViewers() // length === 1, expected 2
await documentViewers[0].loadDocument(url1, { customHeaders })
await documentViewers[1].loadDocument(url2, { customHeaders }) // fails — index 1 undefined

Please check it , thanks

Hi Jimmy.

After enabling multiViewerMode, the second documentViewer is not immediately available.
Please try waiting for the event “multiViewerReady” before loading any documents:

UI.addEventListener(UI.Events.MULTI_VIEWER_READY, () => {
    const documentViewers = Core.getDocumentViewers();
    documentViewers[0].loadDocument(url1, { customHeaders });
    documentViewers[1].loadDocument(url2, { customHeaders });
  });

Let us know if this resolves your issue.

Best Regards,
Mickaël.