Package com.evopdf
Class ImageElement
java.lang.Object
com.evopdf.PageElement
com.evopdf.PageGraphicElement
com.evopdf.ImageElement
Objects of this class can be added to a PDF document to render images
-
Constructor Summary
ConstructorsConstructorDescriptionImageElement
(float x, float y, byte[] imageData) Creates anImageElement
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 ratioImageElement
(float x, float y, float destWidth, byte[] imageData) Creates anImageElement
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 ratioImageElement
(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, byte[] imageData) Creates anImageElement
object from the specified image data that will be rendered at the position (x,y) with the (destWidth,destHeight) sizeImageElement
(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, String filePath) Creates anImageElement
from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) sizeImageElement
(float x, float y, float destWidth, float destHeight, byte[] imageData) Creates anImageElement
object from the specified image data that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratioImageElement
(float x, float y, float destWidth, float destHeight, String filePath) Creates anImageElement
from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratioImageElement
(float x, float y, float destWidth, String filePath) Creates anImageElement
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 ratioImageElement
(float x, float y, String filePath) Creates anImageElement
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 TypeMethodDescriptionfloat
Gets the image destination height in PDF pagefloat
Gets the image destination width in PDF pageboolean
Gets the flag indicating if the image can be enlarged if necessary to fit the destination in PDF.byte[]
Gets the underlying image databoolean
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 pageboolean
Gets the flag indicating if the aspect ratio of the image should be kept when the image is rendered in PDFboolean
paginate()
Gets the flag indicating if the element can be paginated and rendered in many PDF pagesboolean
Gets the flag indicating if the multi-frame images rendering is enabledboolean
Gets the flag indicating if the image alpha transparency information is used when the image is rendered in PDFvoid
setDestHeight
(float destHeight) Sets the image destination height in PDF pagevoid
setDestWidth
(float destWidth) Sets the image destination width in PDF pagevoid
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 PDFvoid
setPaginate
(boolean paginate) Sets the flag indicating if the element can be paginated and rendered in many PDF pagesvoid
setRenderMultiFrame
(boolean renderMultiFrame) Sets the flag indicating if the multi-frame images rendering is enabledvoid
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 pagevoid
setYLocation
(float y) Sets the image element location on Y in PDF pagefloat
Gets the image element location on X in PDF pagefloat
Gets the image element location on Y in PDF pageMethods inherited from class com.evopdf.PageGraphicElement
backColor, blending, clipRectangle, foreColor, gradient, lineStyle, opacity, rotate, scale, setBackColor, setBlending, setClipRectangle, setForeColor, setGradient, setLineStyle, setOpacity, skew, translate
-
Constructor Details
-
ImageElement
Creates anImageElement
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 renderedy
- the Y location where this element will be renderedfilePath
- 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
Creates anImageElement
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 renderedy
- the Y location where this element will be rendereddestWidth
- the destination rectangle widthfilePath
- 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 anImageElement
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 renderedy
- the Y location where this element will be renderedimageData
- the image data
-
ImageElement
public ImageElement(float x, float y, float destWidth, byte[] imageData) Creates anImageElement
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 renderedy
- the Y location where this element will be rendereddestWidth
- the destination rectangle widthimageData
- the image data
-
ImageElement
public ImageElement(float x, float y, float destWidth, float destHeight, String filePath) throws Exception Creates anImageElement
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 renderedy
- the Y location where this element will be rendereddestWidth
- the destination rectangle widthdestHeight
- the destination rectangle heightfilePath
- 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 anImageElement
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 renderedy
- the Y location where this element will be rendereddestWidth
- the destination rectangle widthdestHeight
- the destination rectangle heightkeepAspectRatio
- a flag indicating if the aspect ratio of the image is kept when the image is rendered in PDFfilePath
- 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 anImageElement
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 renderedy
- the Y location where this element will be rendereddestWidth
- the destination rectangle widthdestHeight
- the destination rectangle heightimageData
- the image data
-
ImageElement
public ImageElement(float x, float y, float destWidth, float destHeight, boolean keepAspectRatio, byte[] imageData) Creates anImageElement
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 renderedy
- the Y location where this element will be rendereddestWidth
- the destination rectangle widthdestHeight
- the destination rectangle heightkeepAspectRatio
- a flag indicating if the aspect ratio of the image is kept when the image is rendered in PDFimageData
- 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
-