Class RichMediaAnnotation

java.lang.Object
com.itextpdf.text.pdf.richmedia.RichMediaAnnotation

public class RichMediaAnnotation extends 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 Details

    • 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 HashMap<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 Details

    • 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 Details

    • 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(String name, PdfFileSpecification fs) throws IOException
      Adds an embedded file. (Part of the RichMediaContent.)
      Parameters:
      name - a name for the name tree
      fs - a file specification for an embedded file.
      Throws:
      IOException
    • addAsset

      public PdfIndirectReference addAsset(String name, PdfIndirectReference ref) throws IOException
      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

      public PdfIndirectReference addConfiguration(PdfIndirectReference ref) throws IOException
      Adds a reference to a RichMediaConfiguration. (Part of the RichMediaContent.)
      Parameters:
      ref - a reference to a RichMediaConfiguration
      Throws:
      IOException
    • addView

      public PdfIndirectReference addView(PdfDictionary view) throws IOException
      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

      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 IOException
      Creates the actual annotation and adds different elements to the PdfWriter while doing so.
      Returns:
      a PdfAnnotation
      Throws:
      IOException