| FoxitPDFSDKforWeb v11.0.4 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
ReadAloudService Class Reference
PDFViewCtrl » readAloud

Read aloud feature service. More...

## Public Member Functions
| onReadPageEnd (callback:(pageIndex:number)=> void)
| Add event listener to trigger callback function when the page reading is over. More...
| onReadPageStart (callback:(pageIndex:number)=> void)
| Add event listener to trigger callback function when read to a page. More...
| onStatusChange (callback:(status:PDFTextToSpeechSynthesisStatus)=> void)
| Add a callback to monitor the status changes. More...
| pause ()
| Pause reading out loud. More...
| readPages (pageIndexes:number[], options?:Partial< ReadAloudOptions >)
| Read the list of pages according to the given options. More...
| readText (info:ReadAloudTextInformation, options?:Partial< ReadAloudOptions >)
| Read aloud the specified text content. More...
| resume ()
| Resume reading out loud. More...
| setRate (rate:number)
| Adjust the speed to be faster or slower. More...
| setSpeechSynthesis (speechSynthesis:PDFTextToSpeechSynthesis)
| Overwrites the built-in synthesizer using a custom voice synthesizer. More...
| setVolume (volume:number)
| Turn the voice up and down. More...
get | status ()
| Current status. . More...
| stop ()
| Stop reading out loud. More...
| supported ()
| Check if the current browser supports read aloud. More...
| updatePlayingOptions (options:Partial< ReadAloudOptions >)
| Update the playing speech synthesizer parameters. More...

## Detailed Description

Read aloud feature service.

See also
  PDFViewer.getReadAloudService

Since
  8.0.0

## Member Function Documentation

## ◆ onReadPageEnd()

ReadAloudService::onReadPageEnd | ( |  | callback:(pageIndex:number),
|  |  | void
| ) |  |
| inline

Add event listener to trigger callback function when the page reading is over.

Parameters

  callback | (pageIndex: number) => void - Event callback function

Returns
  ()=>void - A function used to remove event listener.

Since
  8.0.0

## ◆ onReadPageStart()

ReadAloudService::onReadPageStart | ( |  | callback:(pageIndex:number),
|  |  | void
| ) |  |
| inline

Add event listener to trigger callback function when read to a page.

Parameters

  callback | (pageIndex: number) => void - Event callback function

Returns
  ()=>void - A function used to remove event listener.

Since
  8.0.0

## ◆ onStatusChange()

ReadAloudService::onStatusChange | ( |  | callback:(status:PDFTextToSpeechSynthesisStatus),
|  |  | void
| ) |  |
| inline

Add a callback to monitor the status changes.

Parameters

  callback | (status:PDFTextToSpeechSynthesisStatus)=>void - Event callback function

Returns
  ()=>void - Returns a function to remove this monitoring.

Since
  8.0.0

## ◆ pause()

ReadAloudService::pause | ( |  | ) |
| inline

Pause reading out loud.

Since
  8.0.0

Returns
  void

## ◆ readPages()

ReadAloudService::readPages | ( |  | pageIndexes:number[],
|  |  | options?:Partial< ReadAloudOptions >
| ) |  |
| inline

Read the list of pages according to the given options.

Parameters

  pageIndexes | number[] - List of page numbers to be read aloud.
  options | Partial<ReadAloudOptions> -

Since
  8.0.0

Returns
  Promise<void>

## ◆ readText()

ReadAloudService::readText | ( |  | info:ReadAloudTextInformation,
|  |  | options?:Partial< ReadAloudOptions >
| ) |  |
| inline

Read aloud the specified text content.

Parameters

  info | ReadAloudTextInformation -
  options | Partial<ReadAloudOptions> -

Since
  8.0.0

Returns
  Promise<void>

## ◆ resume()

ReadAloudService::resume | ( |  | ) |
| inline

Resume reading out loud.

Since
  8.0.0

Returns
  void

## ◆ setRate()

ReadAloudService::setRate | ( |  | rate:number | ) |
| inline

Adjust the speed to be faster or slower.

Parameters

  rate | number - Between 0.1 (lowest) and 10 (highest), 1 is normal speech rate.

Returns
  void

Since
  8.0.0

## ◆ setSpeechSynthesis()

ReadAloudService::setSpeechSynthesis | ( |  | speechSynthesis:PDFTextToSpeechSynthesis | ) |
| inline

Overwrites the built-in synthesizer using a custom voice synthesizer.

Parameters

  speechSynthesis | PDFTextToSpeechSynthesis - A custom speech synthesis instance.

Since
  8.0.0

## ◆ setVolume()

ReadAloudService::setVolume | ( |  | volume:number | ) |
| inline

Turn the voice up and down.

Parameters

  volume | number - Between 0 (lowest) and 1 (highest.)

Since
  8.0.0

Returns
  void

## ◆ status()

get status | ( |  | ) |
| inline

Current status. .

See also
  PDFTextToSpeechSynthesisStatus

Since
  8.0.0

## ◆ stop()

ReadAloudService::stop | ( |  | ) |
| inline

Stop reading out loud.

Since
  8.0.0

Returns
  void

## ◆ supported()

ReadAloudService::supported | ( |  | ) |
| inline

Check if the current browser supports read aloud.

Returns
  boolean -

Since
  8.0.0

## ◆ updatePlayingOptions()

ReadAloudService::updatePlayingOptions | ( |  | options:Partial< ReadAloudOptions > | ) |
| inline

Update the playing speech synthesizer parameters.

Parameters

  options | Partial<ReadAloudOptions> - speech synthesizer parameters

Returns
  boolean - Returns true if it is being read and the options is in effect, otherwise false.

Since
  8.0.0

@2025 Foxit Software Incorporated. All rights reserved.