Package com.itextpdf.text.pdf.richmedia
Class RichMediaAnnotation
- java.lang.Object
-
- com.itextpdf.text.pdf.richmedia.RichMediaAnnotation
-
public class RichMediaAnnotation extends java.lang.Object
Object that is able to create Rich Media Annotations as described in the document "Acrobat Supplement to the ISO 32000", referenced in the code as "ExtensionLevel 3". This annotation is described in section 9.6 entitled "Rich Media" of this document. Extension level 3 introduces rich media PDF constructs that support playing a SWF file and provide enhanced rich media. With rich media annotation, Flash applications, video, audio, and other multimedia can be attached to a PDF with expanded functionality. It improves upon the existing 3D annotation structure to support multiple multimedia file assets, including Flash video and compatible variations on the H.264 format. The new constructs allow a two-way scripting bridge between Flash and a conforming application. There is support for generalized linking of a Flash application state to a comment or view, which enables video commenting. Finally, actions can be linked to video chapter points.- Since:
- 5.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected PdfAnnotation
annot
The annotation objectprotected java.util.HashMap<java.lang.String,PdfIndirectReference>
assetsmap
a map with the assets (will be used to construct a name tree.)protected PdfArray
configurations
an array with configurations (will be added to the RichMediaContent).protected PdfDictionary
richMediaContent
the rich media content (can be reused for different annotations)protected PdfIndirectReference
richMediaContentReference
a reference to the RichMediaContent that can be reused.protected PdfDictionary
richMediaSettings
the rich media settings (specific for this annotation)protected PdfArray
views
an array of views (will be added to the RichMediaContent)protected PdfWriter
writer
The PdfWriter to which the annotation will be added.
-
Constructor Summary
Constructors Constructor Description RichMediaAnnotation(PdfWriter writer, Rectangle rect)
Creates a RichMediaAnnotation.RichMediaAnnotation(PdfWriter writer, Rectangle rect, PdfIndirectReference richMediaContentReference)
Creates a RichMediaAnnotation using rich media content that has already been added to the writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfIndirectReference
addAsset(java.lang.String name, PdfFileSpecification fs)
Adds an embedded file.PdfIndirectReference
addAsset(java.lang.String name, PdfIndirectReference ref)
Adds a reference to an embedded file.PdfIndirectReference
addConfiguration(PdfIndirectReference ref)
Adds a reference to a RichMediaConfiguration.PdfIndirectReference
addConfiguration(RichMediaConfiguration configuration)
Adds a RichMediaConfiguration.PdfIndirectReference
addView(PdfDictionary view)
Adds a view dictionary.PdfIndirectReference
addView(PdfIndirectReference ref)
Adds a reference to a view dictionary.PdfAnnotation
createAnnotation()
Creates the actual annotation and adds different elements to the PdfWriter while doing so.PdfIndirectReference
getRichMediaContentReference()
Gets a reference to the RichMediaContent for reuse of the rich media content.void
setActivation(RichMediaActivation richMediaActivation)
Sets the RichMediaActivation dictionary specifying the style of presentation, default script behavior, default view information, and animation style when the annotation is activated.void
setDeactivation(RichMediaDeactivation richMediaDeactivation)
Sets the RichMediaDeactivation dictionary specifying the condition that causes deactivation of the annotation.
-
-
-
Field Detail
-
writer
protected PdfWriter writer
The PdfWriter to which the annotation will be added.
-
annot
protected PdfAnnotation annot
The annotation object
-
richMediaContent
protected PdfDictionary richMediaContent
the rich media content (can be reused for different annotations)
-
richMediaContentReference
protected PdfIndirectReference richMediaContentReference
a reference to the RichMediaContent that can be reused.
-
richMediaSettings
protected PdfDictionary richMediaSettings
the rich media settings (specific for this annotation)
-
assetsmap
protected java.util.HashMap<java.lang.String,PdfIndirectReference> assetsmap
a map with the assets (will be used to construct a name tree.)
-
configurations
protected PdfArray configurations
an array with configurations (will be added to the RichMediaContent).
-
views
protected PdfArray views
an array of views (will be added to the RichMediaContent)
-
-
Constructor Detail
-
RichMediaAnnotation
public RichMediaAnnotation(PdfWriter writer, Rectangle rect)
Creates a RichMediaAnnotation.- Parameters:
writer
- the PdfWriter to which the annotation will be added.rect
- the rectangle where the annotation will be added.
-
RichMediaAnnotation
public RichMediaAnnotation(PdfWriter writer, Rectangle rect, PdfIndirectReference richMediaContentReference)
Creates a RichMediaAnnotation using rich media content that has already been added to the writer. Note that assets, configurations, views added to a RichMediaAnnotation created like this will be ignored.- Parameters:
writer
- the PdfWriter to which the annotation will be added.rect
- the rectangle where the annotation will be added.richMediaContentReference
- reused rich media content.
-
-
Method Detail
-
getRichMediaContentReference
public PdfIndirectReference getRichMediaContentReference()
Gets a reference to the RichMediaContent for reuse of the rich media content. Returns null if the content hasn't been added to the OutputStream yet.- Returns:
- a PdfDictionary with RichMediaContent
-
addAsset
public PdfIndirectReference addAsset(java.lang.String name, PdfFileSpecification fs) throws java.io.IOException
Adds an embedded file. (Part of the RichMediaContent.)- Parameters:
name
- a name for the name treefs
- a file specification for an embedded file.- Throws:
java.io.IOException
-
addAsset
public PdfIndirectReference addAsset(java.lang.String name, PdfIndirectReference ref) throws java.io.IOException
Adds a reference to an embedded file. (Part of the RichMediaContent.)- Parameters:
ref
- a reference to a PdfFileSpecification- Throws:
java.io.IOException
-
addConfiguration
public PdfIndirectReference addConfiguration(RichMediaConfiguration configuration) throws java.io.IOException
Adds a RichMediaConfiguration. (Part of the RichMediaContent.)- Parameters:
configuration
- a configuration dictionary- Throws:
java.io.IOException
-
addConfiguration
public PdfIndirectReference addConfiguration(PdfIndirectReference ref) throws java.io.IOException
Adds a reference to a RichMediaConfiguration. (Part of the RichMediaContent.)- Parameters:
ref
- a reference to a RichMediaConfiguration- Throws:
java.io.IOException
-
addView
public PdfIndirectReference addView(PdfDictionary view) throws java.io.IOException
Adds a view dictionary. (Part of the RichMediaContent.)- Parameters:
view
- a view dictionary- Throws:
java.io.IOException
-
addView
public PdfIndirectReference addView(PdfIndirectReference ref) throws java.io.IOException
Adds a reference to a view dictionary. (Part of the RichMediaContent.)- Parameters:
ref
- a reference to a view dictionary- Throws:
java.io.IOException
-
setActivation
public void setActivation(RichMediaActivation richMediaActivation)
Sets the RichMediaActivation dictionary specifying the style of presentation, default script behavior, default view information, and animation style when the annotation is activated. (Part of the RichMediaSettings.)- Parameters:
richMediaActivation
-
-
setDeactivation
public void setDeactivation(RichMediaDeactivation richMediaDeactivation)
Sets the RichMediaDeactivation dictionary specifying the condition that causes deactivation of the annotation. (Part of the RichMediaSettings.)- Parameters:
richMediaDeactivation
-
-
createAnnotation
public PdfAnnotation createAnnotation() throws java.io.IOException
Creates the actual annotation and adds different elements to the PdfWriter while doing so.- Returns:
- a PdfAnnotation
- Throws:
java.io.IOException
-
-