Interface: Files
Groups all the API actions related to file handling.
Properties
addEventListener()
addEventListener: (
eventName,callback) =>void
Adds an event listener for the ‘opened’ event when a file is opened.
Parameters
eventName
"opened"
The event name (e.g., 'opened').
callback
(inputDocument) => void
The callback function to execute when the event is triggered.
Returns
void
Example
viewer.file.addEventListener('opened', () => { console.log('callback') });
emitOpened()
emitOpened: (
inputDocument) =>void
Triggers an event indicating that a file has been opened.
Parameters
inputDocument
The input document that has been opened, either as a File object or a URI string.
Returns
void
Example
viewer.file.emitOpened('https://example.com/file.pdf');
removeEventListener()
removeEventListener: (
eventName,callback) =>void
Removes an event listener for the ‘opened’ event when a file is opened.
Parameters
eventName
"opened"
The event name (e.g., 'opened').
callback
(inputDocument) => void
The callback function to remove.
Returns
void
Example
viewer.file.removeEventListener('opened', () => { console.log('callback') });