Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfSoundAnnotation

    Show / Hide Table of Contents

    Class PdfSoundAnnotation

    Represents the sound annotation.

    Inheritance
    System.Object
    PdfAnnotation
    PdfFileAnnotation
    PdfSoundAnnotation
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    PdfFileAnnotation.Appearance
    PdfAnnotation.SetAppearance(Boolean)
    PdfAnnotation.CalculateBounds(RectangleF, PdfPage, PdfLoadedPage)
    PdfAnnotation.SetValues(String, String)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate, Boolean, PdfGraphics)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate, Boolean)
    PdfAnnotation.CheckFlatten()
    PdfAnnotation.Color
    PdfAnnotation.Opacity
    PdfAnnotation.InnerColor
    PdfAnnotation.Border
    PdfAnnotation.Bounds
    PdfAnnotation.Location
    PdfAnnotation.Size
    PdfAnnotation.Page
    PdfAnnotation.Text
    PdfAnnotation.Author
    PdfAnnotation.Subject
    PdfAnnotation.ModifiedDate
    PdfAnnotation.AnnotationFlags
    PdfAnnotation.Flatten
    PdfAnnotation.FlattenPopUps
    PdfAnnotation.PdfTag
    PdfAnnotation.Layer
    PdfAnnotation.Rotate
    PdfAnnotation.Name
    PdfAnnotation.PropertyChanged
    Namespace: Syncfusion.Pdf.Interactive
    Assembly: Syncfusion.Pdf.Portable.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 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 Description
    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
    PdfFileAnnotation.FileName
    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
    PdfDocument
    PdfPage
    PdfAnnotationCollection

    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
    PdfDocument
    PdfPage
    PdfAnnotationCollection

    ReviewHistory

    Gets the annotation Reviews

    Declaration
    public PdfPopupAnnotationCollection ReviewHistory { get; }
    Property Value
    Type Description
    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
    PdfDocument
    PdfPage
    PdfAnnotationCollection

    Methods

    Initialize()

    Initializes instance.

    Declaration
    protected override void Initialize()
    Overrides
    PdfAnnotation.Initialize()

    Save()

    Saves instance.

    Declaration
    protected override void Save()
    Overrides
    PdfFileAnnotation.Save()

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    PdfDocument
    PdfPage
    PdfAnnotationCollection
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved