Package com.evopdf

# Class FileAttachmentElement

java.lang.Object
com.evopdf.PageElement
com.evopdf.FileAttachmentElement

public class FileAttachmentElement extends PageElement
This class represents a file attachment in the PDF document

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileAttachmentElement(RectangleFloat linkRectangle, byte[] fileData, String attachmentName)`
  Creates a file attachment from a stream and a link in page to the attachment
  `FileAttachmentElement(RectangleFloat linkRectangle, String filePath)`
  Creates a file attachment and a link in page to the attachment

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RgbColor`
  `iconColor()`
  Gets the file attachment icon color
  `FileAttachmentIcon`
  `iconType()`
  Gets the file attachment icon type
  `RectangleFloat`
  `linkRectangle()`
  Gets the file attachment icon rectangle in PDF page
  `void`
  `setIconColor(RgbColor iconColor)`
  Sets the file attachment icon color.
  `void`
  `setIconType(FileAttachmentIcon iconType)`
  Sets the file attachment icon type.
  `void`
  `setLinkRectangle(RectangleFloat linkRectangle)`
  Sets the file attachment icon rectangle in PDF page
  `void`
  `setText(String text)`
  Sets the file attachment text
  `String`
  `text()`
  Gets the file attachment text

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

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

- ## Constructor Details

  - ### FileAttachmentElement

    public FileAttachmentElement(RectangleFloat linkRectangle, String filePath) throws Exception
    Creates a file attachment and a link in page to the attachment
    Parameters:
      `linkRectangle` - The attachment link rectangle in page
      `filePath` - The path to file to be attached
    Throws:
      `Exception` - an exception is thrown if the file attachment element cannot be created

  - ### FileAttachmentElement

    public FileAttachmentElement(RectangleFloat linkRectangle, byte[] fileData, String attachmentName)
    Creates a file attachment from a stream and a link in page to the attachment
    Parameters:
      `linkRectangle` - the attachment link rectangle in page
      `fileData` - the file data
      `attachmentName` - a name for attachment

- ## Method Details

  - ### iconType

    public FileAttachmentIcon iconType()
    Gets the file attachment icon type
    Returns:
      the file attachment icon type

  - ### setIconType

    public void setIconType(FileAttachmentIcon iconType)
    Sets the file attachment icon type. The default icon is paper clip
    Parameters:
      `iconType` - the file attachment icon type to set

  - ### iconColor

    public RgbColor iconColor()
    Gets the file attachment icon color
    Returns:
      the file attachment icon color

  - ### setIconColor

    public void setIconColor(RgbColor iconColor)
    Sets the file attachment icon color. By default is black
    Parameters:
      `iconColor` - the file attachment icon color

  - ### text

    public String text()
    Gets the file attachment text
    Returns:
      the file attachment text

  - ### setText

    public void setText(String text)
    Sets the file attachment text
    Parameters:
      `text` - the file attachment text

  - ### linkRectangle

    public RectangleFloat linkRectangle()
    Gets the file attachment icon rectangle in PDF page
    Returns:
      the file attachment icon rectangle in PDF page

  - ### setLinkRectangle

    public void setLinkRectangle(RectangleFloat linkRectangle)
    Sets the file attachment icon rectangle in PDF page
    Parameters:
      `linkRectangle` - the file attachment icon rectangle to set in PDF page