Class FileAttachment


  • public class FileAttachment
    extends MarkupAnnotation

    A file attachment annotation

    • Method Detail

      • create

        public static FileAttachment create​(Document targetDocument,
                                            Point topLeft,
                                            FileReference attachedFile,
                                            Paint paint)
                                     throws ExistsException

        Create a file attachment annotation.

        The returned file attachment annotation is not yet part of any page. It can be added to a page's list of annotations.
        Parameters:
        targetDocument - The output document with which the returned object is associated
        topLeft - The location of the annotation's upper left corner on the page.
        attachedFile - The file to be attached.
        paint - This paint for the file attachment icon.
        Returns:
        The newly created file attachment annotation.
        Throws:
        java.lang.IllegalArgumentException - if the targetDocument has already been closed
        java.lang.IllegalArgumentException - if the targetDocument is read-only
        java.lang.IllegalArgumentException - if the color space of the paint argument is not a device color space
        java.lang.IllegalArgumentException - if the paint has a non-nulltoolbox.pdf.content.Paint.getTransparency with toolbox.pdf.content.Transparency.getBlendMode other than toolbox.pdf.content.BlendMode.NORMAL
        java.lang.IllegalArgumentException - if the paint argument is not associated with the targetDocument
        java.lang.IllegalArgumentException - if the attachedFile argument is not associated with the targetDocument
        ExistsException - if the attachedFile argument is already used as a plain embedded file, an associated file, or in a file attachment.
        java.lang.IllegalArgumentException - if targetDocument is null
        java.lang.IllegalArgumentException - if topLeft is null
        java.lang.IllegalArgumentException - if attachedFile is null
        java.lang.IllegalArgumentException - if paint is null
      • getIcon

        public FileAttachmentIcon getIcon()
                                   throws CorruptException

        The displayed icon (Getter)

        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        CorruptException - the document is corrupt and the file reference cannot be read
      • getPaint

        public Paint getPaint()
                       throws CorruptException

        The paint for the icon and the popup (Getter)

        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        CorruptException - if the PDF is corrupt and the annotation's paint cannot be read
      • getAttachedFile

        public FileReference getAttachedFile()

        The embedded file (Getter)

        Throws:
        java.lang.IllegalStateException - if the object has already been closed
      • getPopup

        public Popup getPopup()

        The pop-up (Getter)

        Throws:
        java.lang.IllegalStateException - if the object has already been closed