Class PdfSoundAnnotation
Represents the sound annotation.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfSoundAnnotation : PdfFileAnnotation, IPdfWrapper, INotifyPropertyChanged
Remarks
This PdfSoundAnnotation class is used to play a sound clip in PDF document. Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-annotations#sound-annotation for more details.
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new sound annotation.
PdfSoundAnnotation soundAnnotation = new PdfSoundAnnotation(rectangle, @"Input.wav");
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed;
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo;
soundAnnotation.Sound.Bits = 16;
soundAnnotation.Color = new PdfColor(Color.Red);
//Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker;
//Add this annotation to a new page.
page.Annotations.Add(soundAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new sound annotation.
Dim soundAnnotation As New PdfSoundAnnotation(rectangle, "Input.wav")
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo
soundAnnotation.Sound.Bits = 16
soundAnnotation.Color = New PdfColor(Color.Red)
'Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker
'Add this annotation to a new page.
page.Annotations.Add(soundAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
Constructors
PdfSoundAnnotation(RectangleF, Stream)
Initializes a new instance of the PdfSoundAnnotation class.
Declaration
public PdfSoundAnnotation(RectangleF rectangle, Stream data)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | |
System.IO.Stream | data |
Properties
Comments
Gets the annotation comments
Declaration
public PdfPopupAnnotationCollection Comments { get; }
Property Value
Type |
---|
PdfPopupAnnotationCollection |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new sound annotation.
PdfSoundAnnotation soundAnnotation = new PdfSoundAnnotation(rectangle, @"decoded.wav");
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed;
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo;
soundAnnotation.Sound.Bits = 16;
soundAnnotation.Color = new PdfColor(Color.Red);
//Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker;
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
soundAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = soundAnnotation.Comments;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
Dim soundAnnotation As PdfSoundAnnotation = New PdfSoundAnnotation(rectangle, "decoded.wav")
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo
soundAnnotation.Sound.Bits = 16
soundAnnotation.Color = New PdfColor(Color.Red)
'Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
soundAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = soundAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
FileName
Declaration
public override string FileName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The string specifies the file name of the sound annotation. |
Overrides
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new sound annotation.
PdfSoundAnnotation soundAnnotation = new PdfSoundAnnotation(rectangle, @"Input.wav");
//Gets the file name.
string fileName = soundAnnotation.FileName;
//Add this annotation to a new page.
page.Annotations.Add(soundAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new sound annotation.
Dim soundAnnotation As New PdfSoundAnnotation(rectangle, "Input.wav")
'Gets the file name.
Dim fileName As String = soundAnnotation.FileName
'Add this annotation to a new page.
page.Annotations.Add(soundAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
Icon
Gets or sets the icon to be used in displaying the annotation.
Declaration
public PdfSoundIcon Icon { get; set; }
Property Value
Type | Description |
---|---|
PdfSoundIcon | The PdfSoundIcon enumeration member specifying the icon for the annotation. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new sound annotation.
PdfSoundAnnotation soundAnnotation = new PdfSoundAnnotation(rectangle, @"Input.wav");
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed;
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo;
soundAnnotation.Sound.Bits = 16;
soundAnnotation.Color = new PdfColor(Color.Red);
//Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker;
//Add this annotation to a new page.
page.Annotations.Add(soundAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new sound annotation.
Dim soundAnnotation As New PdfSoundAnnotation(rectangle, "Input.wav")
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo
soundAnnotation.Sound.Bits = 16
soundAnnotation.Color = New PdfColor(Color.Red)
'Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker
'Add this annotation to a new page.
page.Annotations.Add(soundAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
ReviewHistory
Gets the annotation Reviews
Declaration
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
Type |
---|
PdfPopupAnnotationCollection |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new sound annotation.
PdfSoundAnnotation soundAnnotation = new PdfSoundAnnotation(rectangle, @"decoded.wav");
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed;
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo;
soundAnnotation.Sound.Bits = 16;
soundAnnotation.Color = new PdfColor(Color.Red);
//Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker;
//Add review State
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
soundAnnotation.ReviewHistory.Add(popup);
//Get Review history
PdfPopupAnnotationCollection reviewCollection = soundAnnotation.ReviewHistory;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
Dim soundAnnotation As PdfSoundAnnotation = New PdfSoundAnnotation(rectangle, "decoded.wav")
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo
soundAnnotation.Sound.Bits = 16
soundAnnotation.Color = New PdfColor(Color.Red)
'Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
soundAnnotation.ReviewHistory.Add(popup)
Dim reviewCollection As PdfPopupAnnotationCollection = soundAnnotation.ReviewHistory
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
Sound
Gets or sets the sound.
Declaration
public PdfSound Sound { get; set; }
Property Value
Type | Description |
---|---|
PdfSound | The PdfSound object specified a sound for the annotation. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new sound annotation.
PdfSoundAnnotation soundAnnotation = new PdfSoundAnnotation(rectangle, @"Input.wav");
soundAnnotation.Sound.Encoding = PdfSoundEncoding.Signed;
soundAnnotation.Sound.Channels = PdfSoundChannels.Stereo;
soundAnnotation.Sound.Bits = 16;
soundAnnotation.Color = new PdfColor(Color.Red);
//Sets the pdf sound icon.
soundAnnotation.Icon = PdfSoundIcon.Speaker;
//Add this annotation to a new page.
page.Annotations.Add(soundAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new sound annotation.
Dim soundAnnotation As New PdfSoundAnnotation(rectangle, "Input.wav")
'Set the pdf sound
soundAnnotation.Sound = New PdfSound("Input.wav")
'Add this annotation to a new page.
page.Annotations.Add(soundAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
Methods
Initialize()
Initializes instance.
Declaration
protected override void Initialize()
Overrides
Save()
Saves instance.
Declaration
protected override void Save()
Overrides
Implements
System.ComponentModel.INotifyPropertyChanged