Interface: Files
Groups all the api actions related to files.
Properties
addEventListener()
addEventListener: (
eventName
,fn
) =>void
Add an event listener to a file being opened.
Parameters
• eventName: "opened"
• fn
The callback to execute.
Returns
void
Example
PdfToolsViewerApi.file.addEventListener('opened', () => { console.log('callback') });
opened()
opened: (
data
,password
?) =>void
Trigger event indicating that a file has been opened.
Parameters
• data: string
| Uint8Array
| Blob
| File
the data to open: a File or 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('http://example.com/file.pdf');