public class Image extends AbstractElement<Image> implements ILeafElement, IAccessibleElement
Modifier and Type | Field and Description |
---|---|
protected DefaultAccessibilityProperties |
tagProperties |
protected PdfXObject |
xObject |
childElements, nextRenderer, styles
properties
Constructor and Description |
---|
Image(ImageData img)
Creates an Image from an image resource, read in from a file with the iText I/O module.
|
Image(ImageData img, float left, float bottom)
Creates an Image from an image resource, read in from a file with the iText I/O module, on a fixed position.
|
Image(ImageData img, float left, float bottom, float width)
Creates an Image from an image resource, read in from a file with the iText I/O module, with a custom width and on a fixed position.
|
Image(PdfFormXObject xObject)
Creates an Image from a form XObject, the representation of a form in PDF syntax.
|
Image(PdfFormXObject xObject, float left, float bottom)
Creates an Image from a form XObject, the representation of a form in PDF syntax.
|
Image(PdfImageXObject xObject)
Creates an Image from an image XObject, the representation of an image in PDF syntax.
|
Image(PdfImageXObject xObject, float width)
Creates an Image from an image XObject, the representation of an image in PDF syntax, with a custom width.
|
Image(PdfImageXObject xObject, float left, float bottom)
Creates an Image from an image XObject, the representation of an image in PDF syntax, on a fixed position.
|
Image(PdfImageXObject xObject, float left, float bottom, float width)
Creates an Image from an image XObject, the representation of an image in PDF syntax, with a custom width and on a fixed position.
|
Modifier and Type | Method and Description |
---|---|
AccessibilityProperties |
getAccessibilityProperties()
Gets the accessibility properties .
|
float |
getImageHeight()
Gets height of the image.
|
float |
getImageScaledHeight()
Gets scaled height of the image.
|
float |
getImageScaledWidth()
Gets scaled width of the image.
|
float |
getImageWidth()
Gets width of the image.
|
UnitValue |
getMarginBottom()
Gets the current bottom margin width of the image.
|
UnitValue |
getMarginLeft()
Gets the current left margin width of the element.
|
UnitValue |
getMarginRight()
Gets the current right margin width of the image.
|
UnitValue |
getMarginTop()
Gets the current top margin width of the image.
|
ObjectFit |
getObjectFit()
Retrieves the ObjectFit mode for the image.
|
UnitValue |
getPaddingBottom()
Gets the current bottom padding width of the image.
|
UnitValue |
getPaddingLeft()
Gets the current left padding width of the image.
|
UnitValue |
getPaddingRight()
Gets the current right padding width of the image.
|
UnitValue |
getPaddingTop()
Gets the current top padding width of the image.
|
UnitValue |
getWidth()
Gets the width property of the image.
|
PdfXObject |
getXObject()
Gets the XObject contained in this image object
|
protected IRenderer |
makeNewRenderer() |
Image |
scale(float horizontalScaling, float verticalScaling)
Scale the image relative to its default size.
|
Image |
scaleAbsolute(float fitWidth, float fitHeight)
Scale the image to an absolute size.
|
Image |
scaleToFit(float fitWidth, float fitHeight)
Scale the image to an absolute size.
|
Image |
setAutoScale(boolean autoScale)
Sets the autoscale property for both width and height.
|
Image |
setAutoScaleHeight(boolean autoScale)
Sets the autoscale property for the height of the image.
|
Image |
setAutoScaleWidth(boolean autoScale)
Sets the autoscale property for the width of the image.
|
Image |
setFixedPosition(float left, float bottom)
Sets values for a absolute repositioning of the Element.
|
Image |
setFixedPosition(int pageNumber, float left, float bottom)
Sets values for a absolute repositioning of the Element, on a specific page.
|
Image |
setHeight(float height)
Sets the height property of the image, measured in points.
|
Image |
setHeight(UnitValue height)
Sets the height property of the image with a UnitValue .
|
Image |
setMarginBottom(float value)
Sets the bottom margin width of the image.
|
Image |
setMarginLeft(float value)
Sets the left margin width of the element.
|
Image |
setMarginRight(float value)
Sets the right margin width of the image.
|
Image |
setMargins(float marginTop, float marginRight, float marginBottom, float marginLeft)
Sets the margins around the image to a series of new widths.
|
Image |
setMarginTop(float value)
Sets the top margin width of the image.
|
Image |
setMaxHeight(float maxHeight)
Sets the max-height property of the image, measured in points.
|
Image |
setMaxHeight(UnitValue maxHeight)
Sets the max-height property of the image with a UnitValue .
|
Image |
setMaxWidth(float maxWidth)
Sets the max-width property of the image, measured in points.
|
Image |
setMaxWidth(UnitValue maxWidth)
Sets the max-width property of the image with a UnitValue .
|
Image |
setMinHeight(float minHeight)
Sets the min-height property of the image, measured in points.
|
Image |
setMinHeight(UnitValue minHeight)
Sets the min-height property of the image with a UnitValue .
|
Image |
setMinWidth(float minWidth)
Sets the min-width property of the image, measured in points.
|
Image |
setMinWidth(UnitValue minWidth)
Sets the min-width property of the image with a UnitValue .
|
Image |
setObjectFit(ObjectFit objectFit)
Sets an object-fit mode for the image.
|
Image |
setPadding(float commonPadding)
Sets all paddings around the image to the same width.
|
Image |
setPaddingBottom(float value)
Sets the bottom padding width of the image.
|
Image |
setPaddingLeft(float value)
Sets the left padding width of the image.
|
Image |
setPaddingRight(float value)
Sets the right padding width of the image.
|
Image |
setPaddings(float paddingTop, float paddingRight, float paddingBottom, float paddingLeft)
Sets the paddings around the image to a series of new widths.
|
Image |
setPaddingTop(float value)
Sets the top padding width of the image.
|
Image |
setRotationAngle(double radAngle)
Sets the rotation radAngle.
|
Image |
setWidth(float width)
Sets the width property of the image, measured in points.
|
Image |
setWidth(UnitValue width)
Sets the width property of the image with a UnitValue .
|
addStyle, createRendererSubTree, getChildren, getProperty, getRenderer, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
deleteOwnProperty, getDefaultProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBold, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFont, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setItalic, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createRendererSubTree, getRenderer, setNextRenderer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
protected PdfXObject xObject
protected DefaultAccessibilityProperties tagProperties
public Image(PdfImageXObject xObject)
Image
from an image XObject, the representation of an image in PDF syntax.
xObject
- an internal PdfImageXObject
public Image(PdfFormXObject xObject)
Image
from a form XObject, the representation of a form in PDF syntax.
xObject
- an internal PdfFormXObject
public Image(PdfImageXObject xObject, float width)
Image
from an image XObject, the representation of an image in PDF syntax, with a custom width.
xObject
- an internal PdfImageXObject
width
- a float value
public Image(PdfImageXObject xObject, float left, float bottom, float width)
Image
from an image XObject, the representation of an image in PDF syntax, with a custom width and on a fixed position.
xObject
- an internal PdfImageXObject
left
- a float value representing the horizontal offset of the lower left corner of the image
bottom
- a float value representing the vertical offset of the lower left corner of the image
width
- a float value
public Image(PdfImageXObject xObject, float left, float bottom)
Image
from an image XObject, the representation of an image in PDF syntax, on a fixed position.
xObject
- an internal PdfImageXObject
left
- a float value representing the horizontal offset of the lower left corner of the image
bottom
- a float value representing the vertical offset of the lower left corner of the image
public Image(PdfFormXObject xObject, float left, float bottom)
Image
from a form XObject, the representation of a form in PDF syntax.
xObject
- an internal PdfFormXObject
left
- a float value representing the horizontal offset of the lower left corner of the form
bottom
- a float value representing the vertical offset of the lower left corner of the form
public Image(ImageData img)
Image
from an image resource, read in from a file with the iText I/O module.
img
- an internal representation of the image resource
public Image(ImageData img, float left, float bottom)
Image
from an image resource, read in from a file with the iText I/O module, on a fixed position.
img
- an internal representation of the image resource
left
- a float value representing the horizontal offset of the lower left corner of the image
bottom
- a float value representing the vertical offset of the lower left corner of the image
public Image(ImageData img, float left, float bottom, float width)
Image
from an image resource, read in from a file with the iText I/O module, with a custom width and on a fixed position.
img
- an internal representation of the image resource
left
- a float value representing the horizontal offset of the lower left corner of the image
bottom
- a float value representing the vertical offset of the lower left corner of the image
width
- a float value
public PdfXObject getXObject()
PdfXObject
public Image setRotationAngle(double radAngle)
radAngle
- a value in radians
public UnitValue getMarginLeft()
UnitValue
object
public Image setMarginLeft(float value)
value
- the new left margin width
public UnitValue getMarginRight()
UnitValue
object
public Image setMarginRight(float value)
value
- the new right margin width
public UnitValue getMarginTop()
UnitValue
object
public Image setMarginTop(float value)
value
- the new top margin width
public UnitValue getMarginBottom()
UnitValue
object
public Image setMarginBottom(float value)
value
- the new bottom margin width
public Image setMargins(float marginTop, float marginRight, float marginBottom, float marginLeft)
marginTop
- the new margin top width
marginRight
- the new margin right width
marginBottom
- the new margin bottom width
marginLeft
- the new margin left width
public UnitValue getPaddingLeft()
UnitValue
object
public Image setPaddingLeft(float value)
value
- the new left padding width
public UnitValue getPaddingRight()
UnitValue
object
public Image setPaddingRight(float value)
value
- the new right padding width
public UnitValue getPaddingTop()
UnitValue
object
public Image setPaddingTop(float value)
value
- the new top padding width
public UnitValue getPaddingBottom()
UnitValue
object
public Image setPaddingBottom(float value)
value
- the new bottom padding width
public Image setPadding(float commonPadding)
commonPadding
- the new padding width
public Image setPaddings(float paddingTop, float paddingRight, float paddingBottom, float paddingLeft)
paddingTop
- the new padding top width
paddingRight
- the new padding right width
paddingBottom
- the new padding bottom width
paddingLeft
- the new padding left width
public Image scale(float horizontalScaling, float verticalScaling)
horizontalScaling
- the horizontal scaling coefficient. default value 1 = 100%
verticalScaling
- the vertical scaling coefficient. default value 1 = 100%
public Image scaleToFit(float fitWidth, float fitHeight)
fitWidth
- the new maximum width of the image
fitHeight
- the new maximum height of the image
public Image scaleAbsolute(float fitWidth, float fitHeight)
fitWidth
- the new absolute width of the image
fitHeight
- the new absolute height of the image
public Image setAutoScale(boolean autoScale)
autoScale
- whether or not to let the image resize automatically
public Image setAutoScaleHeight(boolean autoScale)
autoScale
- whether or not to let the image height resize automatically
public Image setAutoScaleWidth(boolean autoScale)
autoScale
- whether or not to let the image width resize automatically
public Image setFixedPosition(float left, float bottom)
Property.POSITION
is changed to fixed
.
left
- horizontal position on the page
bottom
- vertical position on the page
public Image setFixedPosition(int pageNumber, float left, float bottom)
Property.POSITION
is changed to fixed
.
pageNumber
- the page where the element must be positioned
left
- horizontal position on the page
bottom
- vertical position on the page
public float getImageWidth()
public float getImageHeight()
public Image setHeight(float height)
height
- a value measured in points.
public Image setHeight(UnitValue height)
UnitValue
.
height
- a value measured in points.
public Image setMaxHeight(float maxHeight)
maxHeight
- a value measured in points.
public Image setMaxHeight(UnitValue maxHeight)
UnitValue
.
maxHeight
- a value measured in points.
public Image setMinHeight(float minHeight)
minHeight
- a value measured in points.
public Image setMinHeight(UnitValue minHeight)
UnitValue
.
minHeight
- a value measured in points.
public Image setMaxWidth(float maxWidth)
maxWidth
- a value measured in points.
public Image setMaxWidth(UnitValue maxWidth)
UnitValue
.
maxWidth
- a value measured in points.
public Image setMinWidth(float minWidth)
minWidth
- a value measured in points.
public Image setMinWidth(UnitValue minWidth)
UnitValue
.
minWidth
- a value measured in points.
public Image setWidth(float width)
width
- a value measured in points.
public Image setWidth(UnitValue width)
UnitValue
.
width
- a UnitValue
object
public UnitValue getWidth()
UnitValue
public float getImageScaledWidth()
public float getImageScaledHeight()
public Image setObjectFit(ObjectFit objectFit)
objectFit
- is the ObjectFit
mode
public ObjectFit getObjectFit()
ObjectFit
mode for the image.
ObjectFit.FILL
otherwise
public AccessibilityProperties getAccessibilityProperties()
IAccessibleElement
accessibility properties
. See also IAccessibleElement
.
getAccessibilityProperties
in interface IAccessibleElement
protected IRenderer makeNewRenderer()
makeNewRenderer
in class AbstractElement<Image>
Copyright © 1998–2023 iText Group NV. All rights reserved.