Package com.itextpdf.kernel.pdf.annot
Class PdfSoundAnnotation
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.pdf.annot.PdfAnnotation
-
- com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
-
- com.itextpdf.kernel.pdf.annot.PdfSoundAnnotation
-
public class PdfSoundAnnotation extends PdfMarkupAnnotation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
PdfAnnotation.PdfUnknownAnnotation
-
-
Field Summary
-
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
inReplyTo, popup
-
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
Accepted, Canceled, Completed, HIDDEN, HIGHLIGHT_INVERT, HIGHLIGHT_NONE, HIGHLIGHT_OUTLINE, HIGHLIGHT_PUSH, HIGHLIGHT_TOGGLE, INVISIBLE, LOCKED, LOCKED_CONTENTS, Marked, MarkedModel, NO_ROTATE, NO_VIEW, NO_ZOOM, None, page, PRINT, READ_ONLY, Rejected, ReviewModel, STYLE_BEVELED, STYLE_DASHED, STYLE_INSET, STYLE_SOLID, STYLE_UNDERLINE, TOGGLE_NO_VIEW, Unmarked
-
-
Constructor Summary
Constructors Modifier Constructor Description PdfSoundAnnotation(Rectangle rect, PdfStream sound)
Creates a new Sound annotation.protected
PdfSoundAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfSoundAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.PdfSoundAnnotation(PdfDocument document, Rectangle rect, java.io.InputStream soundStream, float sampleRate, PdfName encoding, int channels, int sampleSizeInBits)
Creates a sound annotation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.io.InputStream
correctWavFile(java.io.InputStream is)
PdfName
getIconName()
The name of an icon that is used in displaying the annotation.PdfStream
getSound()
PdfName
getSubtype()
Gets aPdfName
which value is a subtype of this annotation.PdfSoundAnnotation
setIconName(PdfName name)
The name of an icon that is used in displaying the annotation.-
Methods inherited from class com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
getCreationDate, getExternalData, getInReplyTo, getInReplyToObject, getIntent, getOpacity, getPopup, getPopupObject, getReplyType, getRichText, getSubject, getText, setCreationDate, setExternalData, setInReplyTo, setIntent, setOpacity, setPopup, setReplyType, setRichText, setSubject, setText
-
Methods inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
addAssociatedFile, flush, getAppearanceDictionary, getAppearanceObject, getAppearanceState, getAssociatedFiles, getBlendMode, getBorder, getColorObject, getContents, getDate, getDownAppearanceObject, getFlags, getLang, getName, getNonStrokingOpacity, getNormalAppearanceObject, getPage, getPageObject, getRectangle, getRolloverAppearanceObject, getStrokingOpacity, getStructParentIndex, getTitle, hasFlag, isWrappedObjectMustBeIndirect, makeAnnotation, put, remove, resetFlag, setAppearance, setAppearance, setAppearanceState, setBlendMode, setBorder, setBorder, setColor, setColor, setColor, setContents, setContents, setDate, setDownAppearance, setDownAppearance, setFlag, setFlags, setLang, setLayer, setName, setNonStrokingOpacity, setNormalAppearance, setNormalAppearance, setPage, setRectangle, setRolloverAppearance, setRolloverAppearance, setStrokingOpacity, setStructParentIndex, setTitle
-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
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 pagesound
- thePdfStream
with sound
-
PdfSoundAnnotation
protected PdfSoundAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfSoundAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.- Parameters:
pdfObject
- thePdfDictionary
representing annotation object- See Also:
PdfAnnotation.makeAnnotation(PdfObject)
-
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
- thePdfDocument
to which annotation will be addedrect
- the rectangle that specifies annotation position and bounds on pagesoundStream
- thePdfStream
with soundsampleRate
- the sampling rate, in samples per secondencoding
- the encoding format for the sample datachannels
- the number of sound channelssampleSizeInBits
- 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 aPdfName
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 classPdfAnnotation
- Returns:
- subtype of this annotation.
-
getSound
public PdfStream getSound()
-
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. SeesetIconName(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
- aPdfName
that specifies the icon for displaying annotation. Possible values are different for different annotation types:- Speaker
- Mic
- Returns:
- this
PdfSoundAnnotation
instance.
-
-