API References
NPM document-opening methods and their SDK broker mapping.
Verified against SDK 2.2.3. Mount the viewer and await viewer.ready() before opening a document. Use viewer.documents.open({ url, displayName }) for a Canvas-reachable URL, or viewer.documents.open({ path, displayName }) for a deployment-resolved server path.
Use viewer.documents.openFile(file) for a browser File selected by an input or drop handler. The SDK reads the file and manages request correlation. A matching fileReady event confirms completion; metadata snapshots alone do not resolve opening.
In the example, file is the browser File selected by the operator and viewer is an already mounted, ready SDK viewer.
openFile() sends viewFile with the payload below. requestId is generated by the SDK by default; buffer is the ArrayBuffer read from file and included in the transfer list. These names describe SDK internals, not host setup requirements or public exported payload types.
Normal NPM applications call openFile(file); they do not build this payload or manage correlation manually. This mapping does not change the standalone PostMessage contract.
