FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
ReadAloudAddon Class Reference

Represents the Read Aloud Addon in the PDFUI, allowing users to have documents read aloud. More...

Inherits UIXAddon.

Public Member Functions

 onActivationChange (callback)
 Registers event listeners to track changes in the Read Aloud activation status. More...
 

Detailed Description

Represents the Read Aloud Addon in the PDFUI, allowing users to have documents read aloud.

The Read Aloud Addon provides functionality for text-to-speech (TTS) reading of PDF documents, enabling users to have the content read aloud with customizable options.

Since
9.2.0
Example of obtaining and using the Read Aloud Addon instance:
pdfui.getAddonInstance('ReadAloudAddon').then(readAloudAddon => {
if (readAloudAddon) {
// You can now use the readAloudAddon to initiate text-to-speech reading.
readAloudAddon.onActivationChange(()=>{});
} else {
console.error("Read Aloud Addon instance not found.");
}
});

Member Function Documentation

◆ onActivationChange()

ReadAloudAddon::onActivationChange (   callback)
inline

Registers event listeners to track changes in the Read Aloud activation status.

This method allows you to set up event listeners that will notify you when the Read Aloud is activated or deactivated.

Parameters
callback(isActivated:boolean)=>void - A callback function that will be invoked when the Read Aloud's activation status changes. The callback receives one parameter:
  • isActivated (boolean): A boolean value indicating whether the Read Aloud Addon is currently activated (true) or deactivated (false).
Returns
()=>void - A function that can be used to unregister the event listeners.
Since
9.2.0
Example of registering event listeners for Read Aloud Addon activation changes:
pdfui.getAddonInstance('ReadAloudAddon').then(readAloudAddon => {
const callback = (isActivated) => {
if (isActivated) {
console.log('Read Aloud Addon is activated.');
} else {
console.log('Read Aloud Addon is deactivated.');
}
};
const unregisterEvent = readAloudAddon.onActivationChange(callback);
// To unregister the event listeners when no longer needed:
// unregisterEvent();
});

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.