Class PdfSoundAnnotation
- Namespace
- Syncfusion.Pdf.Interactive
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents the sound annotation.
public class PdfSoundAnnotation : PdfFileAnnotation, INotifyPropertyChanged
- Inheritance
-
PdfSoundAnnotation
- Implements
- Inherited Members
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)
Remarks
This PdfSoundAnnotation class is used to play a sound clip in PDF document. Please refer the UG docuemntation link
Constructors
PdfSoundAnnotation(RectangleF, Stream)
Initializes a new instance of the PdfSoundAnnotation class.
public PdfSoundAnnotation(RectangleF rectangle, Stream data)
Parameters
rectangle
RectangleFdata
Stream
- See Also
Properties
Comments
Gets the annotation comments
public PdfPopupAnnotationCollection Comments { get; }
Property Value
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)
- See Also
FileName
public override string FileName { get; set; }
Property Value
- string
The string specifies the file name of the sound 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");
//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.
public PdfSoundIcon Icon { get; set; }
Property Value
- 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
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
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)
- See Also
Sound
Gets or sets the sound.
public PdfSound Sound { get; set; }
Property Value
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.
protected override void Initialize()
- See Also
Save()
Saves instance.
protected override void Save()
- See Also