DocumentView
- Last UpdatedFeb 19, 2025
- 3 minute read
The DocumentView node provides functionality to render and display documents on a 2D view area. The document can be a resource on a local machine or a remote URL.
DocumentView can be considered as a web browser that takes the URL and renders the contents. If the URL points to a file, it invokes a compatible file reader to render the content on the DocumentView.
Different machines can have different associated file readers, so the actual UI inside the webview can vary from machine to machine.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Mouse and keyboard events
Differently to other 2D elements, all the UI events happening on the DocumentView are not propagated to the window panels. The events are consumed in the DocumentView itself.
DocumentView and viewport
A DocumentView is always displayed on top of all the other content displayed in the viewport. It does not support sorting order.
Note: The DocumentView can not be used with the engine running in fullscreen mode (unless Graphics.windows.skipFullScreenHW is set to true into engine configuration file) or with Oculus and OpenVR render paths.
Code examples
This is the code example for the DocumentView node. This code creates a DocumentView at the runtime with its parameters.
Example for opening a Web URL
<DocumentView name="docView" url="https://www.google.com/" position="100 100" size="400 400" visible="false"/>

Example for opening a file on local machine
<DocumentView name="docView" url="file:///D:\Bitbucket\apm\apm\data\file1.pdf" position="100 100" size="400 400" visible="false"/>

DocumentView fields
These are the fields for DocumentView node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > DocumentView
|
Fields |
Type |
Use |
Default Value |
Description |
|---|---|---|---|---|
|
back |
sevent |
Optional |
Moves back in the DocumentView history. |
|
|
forward |
sevent |
Optional |
Moves forward in the DocumentView history. |
|
|
intentFinished |
senum |
Optional |
This field indicates that the activity of launching built-in app to open document has completed. Currently applies to Android only. |
|
|
position |
svec2 |
Optional |
0 0 |
Sets the position of the view. |
|
size |
svec2 |
Optional |
-1 -1 |
Defines the dimension of the 2D object. If the value remains as "-1 -1" the view covers from the assigned position to the right bottom corner of the viewport. |
|
url |
sstring |
Optional |
The URL of the file to be displayed. It can refer to a file on the local machine or remote resources. |
|
|
visible |
sbool |
Optional |
false |
Shows or hides the node. |