Skip to main content
Version: v2023.17.0

Load a document

The JavaScript API allows easy interaction with ARender using various commands listed here .

Load a document​

The loadDocument and openDocument functions from the API, described here allow you to load and open a document on the ARender server.

Note that document opening is secured, so only documents from your document space can be opened.

Implementation example from the iframe​

JavaScript API requests are made on the window object of the iframe, as shown below.

const loadAndOpenDocument = () => {
const iframeWindow = iframeRef.current?.contentWindow;

if (iframeWindow) {
iframeWindow.getARenderJS().loadDocument(
"loadingQuery?url=url/du/document.zip",
(id) => {
console.log(id);
iframeWindow.getARenderJS().openDocument(id);
}
);
} else {
console.error("The iframe is not accessible or not loaded.");
}
};