Interface: Files
Groups all the API actions related to file handling.
Properties
addEventListener()
addEventListener: (
eventName
,fn
) =>void
Adds an event listener for the 'opened' event when a file is opened.
Parameters
• eventName: "opened"
The event name (e.g., 'opened'
).
• fn
The callback function to execute when the event is triggered.
Returns
void
Example
PdfToolsViewerApi.file.addEventListener('opened', () => { console.log('callback') });
opened()
opened: (
data
,password
?) =>void
Triggers an event indicating that a file has been opened.
Parameters
• data: string
| Uint8Array
| Blob
| File
The data to open: a File
, Blob
JavaScript object, a string, or an array representing the file contents.
• password?: string
Optional password to open the PDF data.
Returns
void
Example
PdfToolsViewerApi.file.opened('https://example.com/file.pdf');