Skip to main content
Version: v2023.18.0

Opening a document

Opening documents

  • Object: getARenderJS()
FunctionDescriptionArguments
loadDocument(url, callback)

Loads a document providing an URL. It will provide an ARender Id back.

Note: This is purely a server-side operation, asynchronous at client side.

url: the URL to open;
callback: the callback function to call when the Id is provided by the server.

openDocument(id, resetUI)Opens a document with the id.
If the value of resetUI is true, or if it is not provided, the UI resets to its initial state; otherwise, the UI remains unchanged.
id: ARender id
resetUI: Reset or not the UI
askChangePage(type, index)Changes the current page.

type: 'Relative', 'Index' or 'Absolute';
index: -1 or 1 for 'Relative' or 'Absolute', otherwise the page number.

enablePDFDocumentHyperlinks(boolean)Activate/de-activate the internal hyperlinks of a document.boolean: Load internal hyperlinks of a document if true, unload them otherwise.
disallowClickOnHyperlinks(boolean)Allow/disallow clicks on a document hyperlink for ARender.boolean: if true, disallow internal hyperlinks of a document, allow them otherwise.
FunctionDescriptionArguments
loadDocument(url, callback)

Loads a document providing an URL. It will provide an ARender Id back.

Note: This is purely a server-side operation, asynchronous at client side.

url: the URL to open;
callback: the callback function to call when the Id is provided by the server.

openDocument(id)Opens a document.id: ARender id
askChangePage(type, index)Changes the current page.

type: 'Relative', 'Index' or 'Absolute';
index: -1 or 1 for 'Relative' or 'Absolute', otherwise the page number.

enablePDFDocumentHyperlinks(boolean)Activate/de-activate the internal hyperlinks of a document.boolean: Load internal hyperlinks of a document if true, unload them otherwise.
disallowClickOnHyperlinks(boolean)Allow/disallow clicks on a document hyperlink for ARender.boolean: if true, disallow internal hyperlinks of a document, allow them otherwise.
// Loads the PDF reference document
getARenderJS().loadDocument(
"loadingQuery?url=http://www.arender.fr/pdf/pdf/PDFReference15_v5.pdf",
function (id) {
getARenderJS().openDocument(id);
}
);
// Move to page 24 (note that page index is starting at 0. So page 1 has index 0)
getARenderJS().askChangePage("Index", 23);
// Move to last page
getARenderJS().askChangePage("Absolute", 1);

In the example above, loadDocument returns an ID (in the form of a string starting with "b64_") that will allow manipulation of the document in the ARender view.

openDocument is then called with the ID of the loaded document as a parameter, thereby displaying the document in question.

Multiple document opening

ARender provides the possibility to open several documents by loading a list of documents which will be provided via JSON in order to define the tree structure. All the technical details can be found here