Package com.evopdf

# Class ImageElement

java.lang.Object
com.evopdf.PageElement
com.evopdf.PageGraphicElement
com.evopdf.ImageElement

public class ImageElement extends PageGraphicElement
Objects of this class can be added to a PDF document to render images

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImageElement(float x, float y, byte[] imageData)`
  Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with a width equal to the available space in page and the height auto determined to keep the aspect ratio
  `ImageElement(float x, float y, float destWidth, byte[] imageData)`
  Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with the specified width destWidth and the height auto determined to keep the aspect ratio
  `ImageElement(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, byte[] imageData)`
  Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with the (destWidth,destHeight) size
  `ImageElement(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, String filePath)`
  Creates an `ImageElement` from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) size
  `ImageElement(float x, float y, float destWidth, float destHeight, byte[] imageData)`
  Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratio
  `ImageElement(float x, float y, float destWidth, float destHeight, String filePath)`
  Creates an `ImageElement` from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratio
  `ImageElement(float x, float y, float destWidth, String filePath)`
  Creates an `ImageElement` object from the specified file that will be rendered at the position (x,y) with the specified width destWidth and the height auto determined to keep the initial aspect ratio
  `ImageElement(float x, float y, String filePath)`
  Creates an `ImageElement` object from the specified file that will be rendered at the position (x,y) with the width equal to available width in page and the height auto determined to keep the initial aspect ratio

- ## Method Summary

  Modifier and Type
  Method
  Description
  `float`
  `destHeight()`
  Gets the image destination height in PDF page
  `float`
  `destWidth()`
  Gets the image destination width in PDF page
  `boolean`
  `enlargeEnabled()`
  Gets the flag indicating if the image can be enlarged if necessary to fit the destination in PDF.
  `byte[]`
  `imageData()`
  Gets the underlying image data
  `boolean`
  `insertNewPagesMode()`
  Gets the flag indicating if the Image element will always insert a new page in the PDF document when rendering next page instead of trying to use an already existing PDF page
  `boolean`
  `keepAspectRatio()`
  Gets the flag indicating if the aspect ratio of the image should be kept when the image is rendered in PDF
  `boolean`
  `paginate()`
  Gets the flag indicating if the element can be paginated and rendered in many PDF pages
  `boolean`
  `renderMultiFrame()`
  Gets the flag indicating if the multi-frame images rendering is enabled
  `boolean`
  `renderTransparentImage()`
  Gets the flag indicating if the image alpha transparency information is used when the image is rendered in PDF
  `void`
  `setDestHeight(float destHeight)`
  Sets the image destination height in PDF page
  `void`
  `setDestWidth(float destWidth)`
  Sets the image destination width in PDF page
  `void`
  `setEnlargeEnabled(boolean enlargeEnabled)`
  Sets flag indicating if the image can be enlarged if necessary to fit the destination in PDF.
  `void`
  `setInsertNewPagesMode(boolean insertNewPagesMode)`
  Sets the flag indicating if the Image element will always insert a new page in the PDF document when rendering next page instead of trying to use an already existing PDF page.
  `void`
  `setKeepAspectRatio(boolean keepAspectRatio)`
  Sets the flag indicating if the aspect ratio of the image should be kept when the image is rendered in PDF
  `void`
  `setPaginate(boolean paginate)`
  Sets the flag indicating if the element can be paginated and rendered in many PDF pages
  `void`
  `setRenderMultiFrame(boolean renderMultiFrame)`
  Sets the flag indicating if the multi-frame images rendering is enabled
  `void`
  `setRenderTransparentImage(boolean renderTransparentImage)`
  Sets flag indicating if the image alpha transparency information is used when the image is rendered in PDF.
  `void`
  `setXLocation(float x)`
  Sets the image element location on X in PDF page
  `void`
  `setYLocation(float y)`
  Sets the image element location on Y in PDF page
  `float`
  `xLocation()`
  Gets the image element location on X in PDF page
  `float`
  `yLocation()`
  Gets the image element location on Y in PDF page

  ### Methods inherited from class com.evopdf.PageGraphicElement

  `backColor, blending, clipRectangle, foreColor, gradient, lineStyle, opacity, rotate, scale, setBackColor, setBlending, setClipRectangle, setForeColor, setGradient, setLineStyle, setOpacity, skew, translate`

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

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

- ## Constructor Details

  - ### ImageElement

    public ImageElement(float x, float y, String filePath) throws Exception
    Creates an `ImageElement` object from the specified file that will be rendered at the position (x,y) with the width equal to available width in page and the height auto determined to keep the initial aspect ratio
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `filePath` - the image file path * @throws Exception an exception is thrown if the image creation fails
    Throws:
      `Exception` - an exception is thrown if the image creation fails

  - ### ImageElement

    public ImageElement(float x, float y, float destWidth, String filePath) throws Exception
    Creates an `ImageElement` object from the specified file that will be rendered at the position (x,y) with the specified width destWidth and the height auto determined to keep the initial aspect ratio
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `destWidth` - the destination rectangle width
      `filePath` - the image file path * @throws Exception an exception is thrown if the image creation fails
    Throws:
      `Exception` - an exception is thrown if the image creation fails

  - ### ImageElement

    public ImageElement(float x, float y, byte[] imageData)
    Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with a width equal to the available space in page and the height auto determined to keep the aspect ratio
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `imageData` - the image data

  - ### ImageElement

    public ImageElement(float x, float y, float destWidth, byte[] imageData)
    Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with the specified width destWidth and the height auto determined to keep the aspect ratio
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `destWidth` - the destination rectangle width
      `imageData` - the image data

  - ### ImageElement

    public ImageElement(float x, float y, float destWidth, float destHeight, String filePath) throws Exception
    Creates an `ImageElement` from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratio
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `destWidth` - the destination rectangle width
      `destHeight` - the destination rectangle height
      `filePath` - the image file path
    Throws:
      `Exception` - an exception is thrown if the image creation fails

  - ### ImageElement

    public ImageElement(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, String filePath) throws Exception
    Creates an `ImageElement` from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) size
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `destWidth` - the destination rectangle width
      `destHeight` - the destination rectangle height
      `keepAspectRatio` - a flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF
      `filePath` - the image file path
    Throws:
      `Exception` - an exception is thrown if the image creation fails

  - ### ImageElement

    public ImageElement(float x, float y, float destWidth, float destHeight, byte[] imageData)
    Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratio
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `destWidth` - the destination rectangle width
      `destHeight` - the destination rectangle height
      `imageData` - the image data

  - ### ImageElement

    public ImageElement(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, byte[] imageData)
    Creates an `ImageElement` object from the specified image data that will be rendered at the position (x,y) with the (destWidth,destHeight) size
    Parameters:
      `x` - the X location where this element will be rendered
      `y` - the Y location where this element will be rendered
      `destWidth` - the destination rectangle width
      `destHeight` - the destination rectangle height
      `keepAspectRatio` - a flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF
      `imageData` - the image data

- ## Method Details

  - ### xLocation

    public float xLocation()
    Gets the image element location on X in PDF page
    Returns:
      the image element location on X in PDF page

  - ### setXLocation

    public void setXLocation(float x)
    Sets the image element location on X in PDF page
    Parameters:
      `x` - the image element location on X in PDF page

  - ### yLocation

    public float yLocation()
    Gets the image element location on Y in PDF page
    Returns:
      the image element location on Y in PDF page

  - ### setYLocation

    public void setYLocation(float y)
    Sets the image element location on Y in PDF page
    Parameters:
      `y` - the image element location on Y in PDF page

  - ### destWidth

    public float destWidth()
    Gets the image destination width in PDF page
    Returns:
      the image destination width in PDF page

  - ### setDestWidth

    public void setDestWidth(float destWidth)
    Sets the image destination width in PDF page
    Parameters:
      `destWidth` - the image destination width in PDF page

  - ### destHeight

    public float destHeight()
    Gets the image destination height in PDF page
    Returns:
      the image destination height in PDF page

  - ### setDestHeight

    public void setDestHeight(float destHeight)
    Sets the image destination height in PDF page
    Parameters:
      `destHeight` - the image destination height in PDF page

  - ### paginate

    public boolean paginate()
    Gets the flag indicating if the element can be paginated and rendered in many PDF pages
    Returns:
      the flag value

  - ### setPaginate

    public void setPaginate(boolean paginate)
    Sets the flag indicating if the element can be paginated and rendered in many PDF pages
    Parameters:
      `paginate` - the flag value to set

  - ### insertNewPagesMode

    public boolean insertNewPagesMode()
    Gets the flag indicating if the Image element will always insert a new page in the PDF document when rendering next page instead of trying to use an already existing PDF page
    Returns:
      the flag value

  - ### setInsertNewPagesMode

    public void setInsertNewPagesMode(boolean insertNewPagesMode)
    Sets the flag indicating if the Image element will always insert a new page in the PDF document when rendering next page instead of trying to use an already existing PDF page. This property is false by default
    Parameters:
      `insertNewPagesMode` - the flag value to set

  - ### renderMultiFrame

    public boolean renderMultiFrame()
    Gets the flag indicating if the multi-frame images rendering is enabled
    Returns:
      the flag value

  - ### setRenderMultiFrame

    public void setRenderMultiFrame(boolean renderMultiFrame)
    Sets the flag indicating if the multi-frame images rendering is enabled
    Parameters:
      `renderMultiFrame` - the flag value to set

  - ### renderTransparentImage

    public boolean renderTransparentImage()
    Gets the flag indicating if the image alpha transparency information is used when the image is rendered in PDF
    Returns:
      the flag value

  - ### setRenderTransparentImage

    public void setRenderTransparentImage(boolean renderTransparentImage)
    Sets flag indicating if the image alpha transparency information is used when the image is rendered in PDF. The default value is true. Set this property to true to use transparency information from the transparent PNG images and bitmap images with alpha channel when the image is rendered in PDF
    Parameters:
      `renderTransparentImage` - the flag value to set

  - ### keepAspectRatio

    public boolean keepAspectRatio()
    Gets the flag indicating if the aspect ratio of the image should be kept when the image is rendered in PDF
    Returns:
      the flag value

  - ### setKeepAspectRatio

    public void setKeepAspectRatio(boolean keepAspectRatio)
    Sets the flag indicating if the aspect ratio of the image should be kept when the image is rendered in PDF
    Parameters:
      `keepAspectRatio` - the flag value to set

  - ### enlargeEnabled

    public boolean enlargeEnabled()
    Gets the flag indicating if the image can be enlarged if necessary to fit the destination in PDF. The default value of the property is true
    Returns:
      the flag value

  - ### setEnlargeEnabled

    public void setEnlargeEnabled(boolean enlargeEnabled)
    Sets flag indicating if the image can be enlarged if necessary to fit the destination in PDF. The default value of the property is true
    Parameters:
      `enlargeEnabled` - the flag value to set

  - ### imageData

    public byte[] imageData()
    Gets the underlying image data
    Returns:
      the underlying image data