Skip to main content
Version: Version 5 beta

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

The callback function to execute when the event is triggered.

Returns

void

Example

PdfToolsViewerApi.file.addEventListener('opened', () => { console.log('callback') });


emitOpened()

emitOpened: (inputDocument) => void

Triggers an event indicating that a file has been opened.

Parameters

inputDocument: InputFile | InputUri

Returns

void

Example

PdfToolsViewerApi.file.emitOpened('https://example.com/file.pdf');