AddSoundAnnotationFromFile

Annotations and hotspot links

Description

This page describes AddSoundAnnotationFromFile in PDFlibPas under the "Annotations and hotspot links" topic. API names, parameters, class names, filenames, and literals are kept exactly as they appear in the Delphi library and DLL entry points.

Review the syntax, parameters, and return values before calling the function.

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.