public class

Sound

extends Markup
java.lang.Object
   ↳ com.pdftron.pdf.Annot
     ↳ com.pdftron.pdf.annots.Markup
       ↳ com.pdftron.pdf.annots.Sound

Class Overview

A sound annotation (PDF 1.2) shall analogous to a text annotation except that instead of a text note, it contains sound recorded from the computer's microphone or imported from a file. When the annotation is activated, the sound shall be played. The annotation shall behave like a text annotation in most ways, with a different icon (by default, a speaker) to indicate that it represents a sound.

Summary

Constants
int e_Mic The Constant e_Mic.
int e_Speaker This integer list represents sub type of the Sound annotation.
int e_Unknown The Constant e_Unknown.
[Expand]
Inherited Constants
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
Public Constructors
Sound(Obj d)
Creates a Sound annotation and initialize it using given Cos/SDF object.
Sound()
Creates an empty Sound annoitation.
Sound(Annot annot)
Creates a Sound annotation and initialize it using given annotation object.
Public Methods
static Sound create(Doc doc, Rect pos)
Creates a new Sound annotation, in the specified document.
static Sound createWithData(Doc doc, Rect pos, Filter source_data, int bits_per_sample, int sample_freq, int num_channels)
Creates a new Sound annotation in the specified document.
int getIcon()
Get the sub type of the Sound annotation.
String getIconName()
Get the sub type of the Sound annotation.
Obj getSoundStream()
Get the initial sound object of the Sound annotation.
void setIcon(int type)
Set the sub type of the Sound annotation.
void setIcon(String type)
Set the sub type of the Sound annotation.
void setSoundStream(Obj sound_stream)
Set the initial sound object of the Sound annotation.
[Expand]
Inherited Methods
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
From class java.lang.Object

Constants

public static final int e_Mic

The Constant e_Mic.

Constant Value: 1 (0x00000001)

public static final int e_Speaker

This integer list represents sub type of the Sound annotation. e_Speaker - Speaker Sound. e_Mic - Mic Sound. e_Unknow - User defined or Invalid. Default value: e_Speaker.

Constant Value: 0 (0x00000000)

public static final int e_Unknown

The Constant e_Unknown.

Constant Value: 2 (0x00000002)

Public Constructors

public Sound (Obj d)

Creates a Sound annotation and initialize it using given Cos/SDF object.

Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.

Parameters
d the input Cos/SDF object

public Sound ()

Creates an empty Sound annoitation.

public Sound (Annot annot)

Creates a Sound annotation and initialize it using given annotation object.

Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.

Parameters
annot the input annotation object

Public Methods

public static Sound create (Doc doc, Rect pos)

Creates a new Sound annotation, in the specified document.

Parameters
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, specified in user space coordinates.
Returns
  • A newly created blank Sound annotation.

public static Sound createWithData (Doc doc, Rect pos, Filter source_data, int bits_per_sample, int sample_freq, int num_channels)

Creates a new Sound annotation in the specified document. Accepts raw audio data, along with a few parameters describing the format of that data

Parameters
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds in default user space units.
source_data The raw sound data for the newly created annot
bits_per_sample The number of bits per sample in source data
sample_freq The number of samples per second present in source data
num_channels The number of audio channels in source_data
Returns
  • A newly created blank Sound annotation.

public int getIcon ()

Get the sub type of the Sound annotation.

Note: The Icon indicates name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the standard types e_Speaker and e_Mic. Additional types may be supported as well. However, user defined sub types has to be represented by string, in the enum"Icon", it will just show as "e_Unknow". Default value: e_Speaker. The annotation dictionary's AP entry, if present, shall take precedence over the Name entry; see Table 168 and 12.5.5, "Appearance Streams."

Returns
  • An entry in the "GetIcon" enum indicating the subtype of the Sound annotation.

public String getIconName ()

Get the sub type of the Sound annotation.

Note: The Icon indicates a name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the standard types Speaker and Mic. Additional types may be supported as well. Default value: Speaker. The annotation dictionary's AP entry, if present, shall take precedence over the Name entry; see Table 168 and 12.5.5, "Appearance Streams."

Returns
  • A string indicating the subtype of the Sound annotation.

public Obj getSoundStream ()

Get the initial sound object of the Sound annotation.

Note: The sound stream is a sound object defining the sound that shall be played when the annotation is activated.

Returns
  • An SDF object representing a sound stream.

public void setIcon (int type)

Set the sub type of the Sound annotation. (Optional)

Note: The Icon indicates name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the standard types e_Speaker and e_Mic. Additional types may be supported as well. However, user defined sub types has to be represented by string. In the enum"Icon", it will just show as "e_Unknow". Default value: e_Speaker. The annotation dictionary's AP entry, if present, shall take precedence over the Name entry; see Table 168 and 12.5.5, "Appearance Streams."

Parameters
type An entry in the "GetIcon" enum indicating the subtype of the Sound annotation.

public void setIcon (String type)

Set the sub type of the Sound annotation. (Optional)

Note: The Icon indicates a name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the standard types Speaker and Mic. Additional types may be supported as well. Default value: Speaker. The annotation dictionary's AP entry, if present, shall take precedence over the Name entry; see Table 168 and 12.5.5, "Appearance Streams."

Parameters
type - A string indicating the subtype of the Sound annotation.

public void setSoundStream (Obj sound_stream)

Set the initial sound object of the Sound annotation.

Note: The sound stream is a sound object defining the sound that shall be played when the annotation is activated.

Parameters
sound_stream - An SDF object representing a sound stream.