Class PDActionSound

java.lang.Object
org.apache.pdfbox.pdmodel.interactive.action.PDAction
org.apache.pdfbox.pdmodel.interactive.action.PDActionSound
All Implemented Interfaces:
COSObjectable, PDDestinationOrAction

public class PDActionSound extends PDAction
This represents a Sound action that can be executed in a PDF document
  • Field Details

  • Constructor Details

    • PDActionSound

      public PDActionSound()
      Default constructor.
    • PDActionSound

      public PDActionSound(COSDictionary a)
      Constructor.
      Parameters:
      a - The action dictionary.
  • Method Details

    • getS

      @Deprecated public String getS()
      Deprecated.
      This will get the type of action that the actions dictionary describes. It must be Sound for a Sound action.
      Returns:
      The S entry of the specific Sound action dictionary.
    • setS

      @Deprecated public void setS(String s)
      This will set the type of action that the actions dictionary describes. It must be Sound for a Sound action.
      Parameters:
      s - The Sound action.
    • setSound

      public void setSound(COSStream sound)
      Sets the sound object.
      Parameters:
      sound - the sound object defining the sound that shall be played.
    • getSound

      public COSStream getSound()
      Gets the sound object.
      Returns:
      The sound object defining the sound that shall be played.
    • setVolume

      public void setVolume(float volume)
      Gets the volume at which to play the sound, in the range −1.0 to 1.0.
      Parameters:
      volume - The volume at which to play the sound, in the range −1.0 to 1.0.
      Throws:
      IllegalArgumentException - if the volume parameter is outside of the range −1.0 to 1.0.
    • getVolume

      public float getVolume()
      Sets the volume.
      Returns:
      The volume at which to play the sound, in the range −1.0 to 1.0. Default value: 1.0.
    • setSynchronous

      public void setSynchronous(boolean synchronous)
      A flag specifying whether to play the sound synchronously or asynchronously. When true, the reader allows no further user interaction other than canceling the sound until the sound has been completely played.
      Parameters:
      synchronous - Whether to play the sound synchronously (true) or asynchronously (false).
    • getSynchronous

      public boolean getSynchronous()
      Gets the synchronous flag. It specifyes whether to play the sound synchronously or asynchronously. When true, the reader allows no further user interaction other than canceling the sound until the sound has been completely played.
      Returns:
      Whether to play the sound synchronously (true) or asynchronously (false, also the default).
    • setRepeat

      public void setRepeat(boolean repeat)
      A flag specifying whether to repeat the sound indefinitely.
      Parameters:
      repeat - Whether to repeat the sound indefinitely.
    • getRepeat

      public boolean getRepeat()
      Gets whether to repeat the sound indefinitely.
      Returns:
      Whether to repeat the sound indefinitely (default: false).
    • setMix

      public void setMix(boolean mix)
      The flag specifying whether to mix this sound with any other sound already playing. If this flag is false, any previously playing sound shall be stopped before starting this sound; this can be used to stop a repeating sound (see Repeat). Default value: false.
      Parameters:
      mix - whether to mix this sound with any other sound already playing. (false).
    • getMix

      public boolean getMix()
      Gets the flag specifying whether to mix this sound with any other sound already playing. If this flag is false, any previously playing sound shall be stopped before starting this sound; this can be used to stop a repeating sound (see Repeat).
      Returns:
      whether to mix this sound with any other sound already playing (default: false).