File Upload
Load documents into the viewer and manage session states through a communication bridge.
File Upload allows you to load documents into the viewer canvas by providing a valid file URL or by passing a real browser File object from an input element. This process initializes the viewer tools and establishes the metadata state for the session.
By managing files through the communication bridge, you maintain total control over document access while leveraging the high-performance rendering engine.
- URL Loading: The file URL must be publicly accessible on the internet.
- Local Loading: The viewFile message requires a real browser File object, usually from an input[type="file"].
- Dynamic Loading: Open any supported document format on the fly.
- Session Lifecycle: Track the status of document processing from start to finish.
- Automated Initialization: Viewer tools auto-calibrate based on the loaded file type.
Send a view payload to load a file and listen for fileInfo to confirm readiness.
Load a file
Load a local browser File
Listen for fileInfo
Loading a document follows a request-response pattern. You dispatch a view message to start the rendering process, and the viewer provides status updates until the document is ready.
1. Host Requests File
Send view with a file URL or viewFile with a browser File object to initialize the session.
1b. Host Requests Local File
Use viewFile when the document comes from the user computer. The payload must contain the actual File object.
2. Viewer Returns Metadata
The viewer broadcasts the fileInfo event once the document is fully loaded and ready for interaction.
The viewer emits specific events to help you manage UI loaders and progress indicators during document processing.
- progressStart: Emitted when the viewer begins downloading or parsing a file.
- progressEnd: Emitted when the processing is complete and the UI is interactive.
Initialize the iframe, load a file from either a URL or a local file input, and handle progress and metadata events.
Test the interactive preview below to see how the session initializes when a new file is requested.
Interactive Workbench
File upload preview
Paste a file URL and send the view message to load a new file in the viewer.
Continue with related file workflows and API references.
- Viewer Setup: Canvas Iframe Initialization
- File Management: File Management
- File API: API References
