Package com.itextpdf.text.pdf.richmedia
Class RichMediaAnnotation
java.lang.Object
com.itextpdf.text.pdf.richmedia.RichMediaAnnotation
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
FieldsModifier and TypeFieldDescriptionprotected PdfAnnotation
The annotation objectprotected HashMap
<String, PdfIndirectReference> a map with the assets (will be used to construct a name tree.)protected PdfArray
an array with configurations (will be added to the RichMediaContent).protected PdfDictionary
the rich media content (can be reused for different annotations)protected PdfIndirectReference
a reference to the RichMediaContent that can be reused.protected PdfDictionary
the rich media settings (specific for this annotation)protected PdfArray
an array of views (will be added to the RichMediaContent)protected PdfWriter
The PdfWriter to which the annotation will be added. -
Constructor Summary
ConstructorsConstructorDescriptionRichMediaAnnotation
(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
Modifier and TypeMethodDescriptionaddAsset
(String name, PdfFileSpecification fs) Adds an embedded file.addAsset
(String name, PdfIndirectReference ref) Adds a reference to an embedded file.Adds a reference to a RichMediaConfiguration.addConfiguration
(RichMediaConfiguration configuration) Adds a RichMediaConfiguration.addView
(PdfDictionary view) Adds a view dictionary.Adds a reference to a view dictionary.Creates the actual annotation and adds different elements to the PdfWriter while doing so.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 Details
-
writer
The PdfWriter to which the annotation will be added. -
annot
The annotation object -
richMediaContent
the rich media content (can be reused for different annotations) -
richMediaContentReference
a reference to the RichMediaContent that can be reused. -
richMediaSettings
the rich media settings (specific for this annotation) -
assetsmap
a map with the assets (will be used to construct a name tree.) -
configurations
an array with configurations (will be added to the RichMediaContent). -
views
an array of views (will be added to the RichMediaContent)
-
-
Constructor Details
-
RichMediaAnnotation
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 Details
-
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
Adds an embedded file. (Part of the RichMediaContent.)- Parameters:
name
- a name for the name treefs
- a file specification for an embedded file.- Throws:
IOException
-
addAsset
Adds a reference to an embedded file. (Part of the RichMediaContent.)- Parameters:
ref
- a reference to a PdfFileSpecification- Throws:
IOException
-
addConfiguration
public PdfIndirectReference addConfiguration(RichMediaConfiguration configuration) throws IOException Adds a RichMediaConfiguration. (Part of the RichMediaContent.)- Parameters:
configuration
- a configuration dictionary- Throws:
IOException
-
addConfiguration
Adds a reference to a RichMediaConfiguration. (Part of the RichMediaContent.)- Parameters:
ref
- a reference to a RichMediaConfiguration- Throws:
IOException
-
addView
Adds a view dictionary. (Part of the RichMediaContent.)- Parameters:
view
- a view dictionary- Throws:
IOException
-
addView
Adds a reference to a view dictionary. (Part of the RichMediaContent.)- Parameters:
ref
- a reference to a view dictionary- Throws:
IOException
-
setActivation
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
Sets the RichMediaDeactivation dictionary specifying the condition that causes deactivation of the annotation. (Part of the RichMediaSettings.)- Parameters:
richMediaDeactivation
-
-
createAnnotation
Creates the actual annotation and adds different elements to the PdfWriter while doing so.- Returns:
- a PdfAnnotation
- Throws:
IOException
-