org.faceless.pdf2

## Class AnnotationFile

- java.lang.Object
- - org.faceless.pdf2.PDFAnnotation
  - - org.faceless.pdf2.AnnotationFile

- All Implemented Interfaces:
    Cloneable

      public final class AnnotationFile
      extends PDFAnnotation

  A subtype new `PDFAnnotation` that allows files to be attached to the PDF. File attachments do not work in the free Acrobat Reader - they require the full version of Acrobat. Currently the "encrypt separately" option added in Acrobat 7 is not supported, although if the document is encrypted the attachment will be encrypted with it.

  Note in revisions prior to 2.6 this class dealt with the file internally. In 2.6 the EmbeddedFile handling was moved to a separate class, `EmbeddedFile`, which now handles all the details of the actual file.

  Since:
    2.4.4

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotationFile()` Create a new File annotation.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `EmbeddedFile` | `getFile()` Return the file embedded in this annotation
    `void` | `rebuild()` Rebuild the annotation's appearance.
    `void` | `setFile(EmbeddedFile file)` Set the contents of this annotation to the specified embedded file.
    `void` | `setType(String type, Color color)` Set the type of attachment - the physical appearance on the page.
    `String` | `toString()`

    - ### Methods inherited from class org.faceless.pdf2.PDFAnnotation

      `addPropertyChangeListener, addReview, flatten, getAuthor, getColor, getContents, getCreationDate, getInReplyTo, getMetaData, getModifyDate, getOpacity, getPage, getPopup, getRectangle, getReplies, getReviews, getSubject, getType, getUniqueID, hasAppearanceState, isContentLocked, isPositionLocked, isPrintable, isReadOnly, isVisible, removePropertyChangeListener, setAuthor, setColor, setContents, setCreationDate, setInReplyTo, setLocked, setMetaData, setModifyDate, setOpacity, setPage, setPrintable, setReadOnly, setRectangle, setSubject, setUniqueID, setVisible`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AnnotationFile

          public AnnotationFile()

      Create a new File annotation. To actually set the attachment, the `setFile()` method must be called.

  - ### Method Detail

    - #### setType

          public void setType(String type,
                              Color color)

      Set the type of attachment - the physical appearance on the page. The type must be one of the four pre-defined types (PushPin, Graph, Paperclip or Tag) or an `IllegalArgumentException` will be thrown.
      Parameters:
        `type` - the type of attachment - one of the four values listed above.
        `color` - the color of the attachment

    - #### setFile

          public void setFile(EmbeddedFile file)

      Set the contents of this annotation to the specified embedded file.
      Parameters:
        `file` - the EmbeddedFile object to attach
      Since:
        2.6

    - #### getFile

          public EmbeddedFile getFile()

      Return the file embedded in this annotation
      Since:
        2.6

    - #### rebuild

          public void rebuild()

      Description copied from class: `PDFAnnotation`
      Rebuild the annotation's appearance. This will be done automatically when required, usually just before saving the PDF or rasterizing it to a bitmap. However this method can be called explicitly if necessary, usually to ensure the rebuild (which may fire a `PropertyChangeEvent`) is run on a specific thread.
      Overrides:
        `rebuild` in class `PDFAnnotation`

    - #### toString

          public String toString()

Copyright © 2001-2015 Big Faceless Organization