Class Sound
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.
Implements
Inherited Members
Namespace: pdftron.PDF.Annots
Assembly: PDFNet.dll
Syntax
public class Sound : Markup, IDisposable
Constructors
Sound(Annot)
Creates a Sound annotation and initialize it using given annotation object.
Declaration
public Sound(Annot ann)
Parameters
Type | Name | Description |
---|---|---|
Annot | ann | the annot |
Remarks
The constructor does not copy any data, but is instead the logical equivalent of a type cast.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Sound(Obj)
Creates a Sound annotation and initialize it using given Cos/SDF object.
Declaration
public Sound(Obj d)
Parameters
Type | Name | Description |
---|---|---|
Obj | d | the d |
Remarks
The constructor does not copy any data, but is instead the logical equivalent of a type cast.
Methods
Create(SDFDoc, Rect)
Creates a new Sound annotation, in the specified document.
Declaration
public static Sound Create(SDFDoc doc, Rect pos)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the annotation is added. |
Rect | pos | A rectangle specifying the annotation's bounds, specified in user space coordinates. |
Returns
Type | Description |
---|---|
Sound | A newly created blank Sound annotation. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateWithData(SDFDoc, Rect, Filter, int, int, int)
Creates a new Sound annotation in the specified document. Accepts raw audio data, along with a few parameters describing the format of that data
Declaration
public static Sound CreateWithData(SDFDoc doc, Rect pos, Filter source_data, int bits_per_sample, int sample_freq, int num_channels)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the annotation is added. |
Rect | pos | A rectangle specifying the annotation's bounds in default user space units. |
Filter | source_data | The raw sound data for the newly created annot |
int | bits_per_sample | The number of bits per sample in source data |
int | sample_freq | The number of samples per second present in source data |
int | num_channels | The number of audio channels in source_data |
Returns
Type | Description |
---|---|
Sound | A newly created blank Sound annotation. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Dispose(bool)
Declaration
[HandleProcessCorruptedStateExceptions]
protected override void Dispose(bool A_0)
Parameters
Type | Name | Description |
---|---|---|
bool | A_0 |
Overrides
~Sound()
Declaration
protected ~Sound()
GetIcon()
Gets the sub type of the Sound annotation.
Declaration
public Sound.Icon GetIcon()
Returns
Type | Description |
---|---|
Sound.Icon | An entry in the "GetIcon" enum indicating the subtype of the Sound annotation. |
Remarks
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.'
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetIconName()
Gets the sub type of the Sound annotation.
Declaration
public string GetIconName()
Returns
Type | Description |
---|---|
string | A string indicating the subtype of the Sound annotation. |
Remarks
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.'
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetSoundStream()
Gets the initial sound object of the Sound annotation.
Declaration
public Obj GetSoundStream()
Returns
Type | Description |
---|---|
Obj | An SDF object representing a sound stream. |
Remarks
The sound stream is a sound object defining the sound that shall be played when the annotation is activated.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetIcon(string)
Sets the sub type of the Sound annotation. (Optional)
Declaration
public void SetIcon(string type)
Parameters
Type | Name | Description |
---|---|---|
string | type |
|
Remarks
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.'
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetIcon(Icon)
Sets the sub type of the Sound annotation. (Optional)
Declaration
public void SetIcon(Sound.Icon type)
Parameters
Type | Name | Description |
---|---|---|
Sound.Icon | type | An entry in the "GetIcon" enum indicating the subtype of the Sound annotation. |
Remarks
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.'
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetSoundStream(Obj)
Sets the initial sound object of the Sound annotation.
Declaration
public void SetSoundStream(Obj sound_stream)
Parameters
Type | Name | Description |
---|---|---|
Obj | sound_stream |
|
Remarks
The sound stream is a sound object defining the sound that shall be played when the annotation is activated.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |