Class PdfSoundAnnotation

    • Constructor Detail

      • PdfSoundAnnotation

        public PdfSoundAnnotation​(Rectangle rect,
                                  PdfStream sound)
        Creates a new Sound annotation. There is a problem playing *.wav files via internal player in Acrobat. The first byte of the audio stream data should be deleted, then wav file will be played correctly. Otherwise it will be broken. Other supporting file types don't have such problem. Sound annotations are deprecated in PDF 2.0.
        Parameters:
        rect - the rectangle that specifies annotation position and bounds on page
        sound - the PdfStream with sound
      • PdfSoundAnnotation

        public PdfSoundAnnotation​(PdfDocument document,
                                  Rectangle rect,
                                  java.io.InputStream soundStream,
                                  float sampleRate,
                                  PdfName encoding,
                                  int channels,
                                  int sampleSizeInBits)
                           throws java.io.IOException
        Creates a sound annotation. Sound annotations are deprecated in PDF 2.0.
        Parameters:
        document - the PdfDocument to which annotation will be added
        rect - the rectangle that specifies annotation position and bounds on page
        soundStream - the PdfStream with sound
        sampleRate - the sampling rate, in samples per second
        encoding - the encoding format for the sample data
        channels - the number of sound channels
        sampleSizeInBits - the number of bits per sample value per channel
        Throws:
        java.io.IOException - in case of corrupted data or source stream problems
    • Method Detail

      • getSubtype

        public PdfName getSubtype()
        Description copied from class: PdfAnnotation
        Gets a PdfName which value is a subtype of this annotation. See ISO-320001 12.5.6, "Annotation Types" for the reference to the possible types.
        Specified by:
        getSubtype in class PdfAnnotation
        Returns:
        subtype of this annotation.
      • correctWavFile

        private static java.io.InputStream correctWavFile​(java.io.InputStream is)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getIconName

        public PdfName getIconName()
        The name of an icon that is used in displaying the annotation. Possible values are different for different annotation types. See setIconName(PdfName).
        Returns:
        a PdfName that specifies the icon for displaying annotation, or null if icon name is not specified.
      • setIconName

        public PdfSoundAnnotation setIconName​(PdfName name)
        The name of an icon that is used in displaying the annotation.
        Parameters:
        name - a PdfName that specifies the icon for displaying annotation. Possible values are different for different annotation types:
        • Speaker
        • Mic
        Additional names may be supported as well.
        Returns:
        this PdfSoundAnnotation instance.