AddSoundAnnotationFromFile
Annotations and hotspot links
Description
Embeds an uncompressed PCM WAV file in a Sound annotation placed on the selected page and returns the 1-based index of the new annotation. It returns 0 when the file cannot be read or is not an uncompressed PCM WAV.
Syntax
Delphi
Function TPDFlib.AddSoundAnnotationFromFile(Left, Top, Width, Height: Double; Const SoundFileName: WideString; Const Title, Contents: WideString; Options: Integer): Integer;
Parameters
Left/Top/Width/Height place the speaker icon on the selected page. SoundFileName is an uncompressed PCM WAV file, 8 or 16 bits per sample, mono or stereo. Title and Contents label the annotation. Options is reserved; pass 0.
Return Values
Returns the 1-based index of the new Sound annotation, or 0 when the file is not an uncompressed PCM WAV.
Remarks
The samples are embedded in a /Sound stream with /E /Signed encoding (ISO 32000-1 §13.3): 16-bit samples are stored big-endian and 8-bit samples are midpoint-shifted to signed form. Read the sound back with GetAnnotSoundToFile or GetAnnotSoundToString. Requires PDF 1.2; the document version is raised automatically.