Class Image
A layout element that represents an image for inclusion in the document model.
public class Image : AbstractElement<Image>, IAbstractElement, ILeafElement, IElement, IPropertyContainer, IAccessibleElement
- Inheritance
-
Image
- Implements
- Derived
- Inherited Members
Constructors
Image(ImageData)
Creates an Image from an image resource, read in from a file with the iText I/O module.
public Image(ImageData img)
Parameters
img
ImageDataan internal representation of the image resource
Image(ImageData, float, float)
Creates an Image from an image resource, read in from a file with the iText I/O module, on a fixed position.
public Image(ImageData img, float left, float bottom)
Parameters
img
ImageDataan internal representation of the image resource
left
floata float value representing the horizontal offset of the lower left corner of the image
bottom
floata float value representing the vertical offset of the lower left corner of the image
Image(ImageData, float, float, float)
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.
public Image(ImageData img, float left, float bottom, float width)
Parameters
img
ImageDataan internal representation of the image resource
left
floata float value representing the horizontal offset of the lower left corner of the image
bottom
floata float value representing the vertical offset of the lower left corner of the image
width
floata float value
Image(PdfFormXObject)
Creates an Image from a form XObject, the representation of a form in PDF syntax.
public Image(PdfFormXObject xObject)
Parameters
xObject
PdfFormXObjectan internal PdfFormXObject
Image(PdfFormXObject, float, float)
Creates an Image from a form XObject, the representation of a form in PDF syntax.
public Image(PdfFormXObject xObject, float left, float bottom)
Parameters
xObject
PdfFormXObjectan internal PdfFormXObject
left
floata float value representing the horizontal offset of the lower left corner of the form
bottom
floata float value representing the vertical offset of the lower left corner of the form
Image(PdfImageXObject)
Creates an Image from an image XObject, the representation of an image in PDF syntax.
public Image(PdfImageXObject xObject)
Parameters
xObject
PdfImageXObjectan internal PdfImageXObject
Image(PdfImageXObject, float)
Creates an Image from an image XObject, the representation of an image in PDF syntax, with a custom width.
public Image(PdfImageXObject xObject, float width)
Parameters
xObject
PdfImageXObjectan internal PdfImageXObject
width
floata float value
Image(PdfImageXObject, float, float)
Creates an Image from an image XObject, the representation of an image in PDF syntax, on a fixed position.
public Image(PdfImageXObject xObject, float left, float bottom)
Parameters
xObject
PdfImageXObjectan internal PdfImageXObject
left
floata float value representing the horizontal offset of the lower left corner of the image
bottom
floata float value representing the vertical offset of the lower left corner of the image
Image(PdfImageXObject, float, float, float)
Creates an Image from an image XObject, the representation of an image in PDF syntax, with a custom width and on a fixed position.
public Image(PdfImageXObject xObject, float left, float bottom, float width)
Parameters
xObject
PdfImageXObjectan internal PdfImageXObject
left
floata float value representing the horizontal offset of the lower left corner of the image
bottom
floata float value representing the vertical offset of the lower left corner of the image
width
floata float value
Fields
tagProperties
protected DefaultAccessibilityProperties tagProperties
Field Value
xObject
protected PdfXObject xObject
Field Value
Methods
GetAccessibilityProperties()
public virtual AccessibilityProperties GetAccessibilityProperties()
Returns
GetImageHeight()
Gets height of the image.
public virtual float GetImageHeight()
Returns
- float
the original height of the image
Remarks
Gets height of the image. It returns height of image or form XObject, not the height set by one of the #setHeight methods
GetImageScaledHeight()
Gets scaled height of the image.
public virtual float GetImageScaledHeight()
Returns
- float
the current scaled height
GetImageScaledWidth()
Gets scaled width of the image.
public virtual float GetImageScaledWidth()
Returns
- float
the current scaled width
GetImageWidth()
Gets width of the image.
public virtual float GetImageWidth()
Returns
- float
the original width of the image
Remarks
Gets width of the image. It returns width of image or form XObject, not the width set by one of the #setWidth methods
GetMarginBottom()
Gets the current bottom margin width of the image.
public virtual UnitValue GetMarginBottom()
Returns
GetMarginLeft()
Gets the current left margin width of the element.
public virtual UnitValue GetMarginLeft()
Returns
GetMarginRight()
Gets the current right margin width of the image.
public virtual UnitValue GetMarginRight()
Returns
GetMarginTop()
Gets the current top margin width of the image.
public virtual UnitValue GetMarginTop()
Returns
GetObjectFit()
Retrieves the ObjectFit mode for the image.
public virtual ObjectFit GetObjectFit()
Returns
GetPaddingBottom()
Gets the current bottom padding width of the image.
public virtual UnitValue GetPaddingBottom()
Returns
GetPaddingLeft()
Gets the current left padding width of the image.
public virtual UnitValue GetPaddingLeft()
Returns
GetPaddingRight()
Gets the current right padding width of the image.
public virtual UnitValue GetPaddingRight()
Returns
GetPaddingTop()
Gets the current top padding width of the image.
public virtual UnitValue GetPaddingTop()
Returns
GetWidth()
Gets the width property of the image.
public virtual UnitValue GetWidth()
Returns
- UnitValue
the width of the element, with a value and a measurement unit.
- See Also
GetXObject()
Gets the XObject contained in this image object
public virtual PdfXObject GetXObject()
Returns
MakeNewRenderer()
protected override IRenderer MakeNewRenderer()
Returns
Scale(float, float)
Scale the image relative to its default size.
public virtual Image Scale(float horizontalScaling, float verticalScaling)
Parameters
horizontalScaling
floatthe horizontal scaling coefficient. default value 1 = 100%
verticalScaling
floatthe vertical scaling coefficient. default value 1 = 100%
Returns
- Image
this element
ScaleAbsolute(float, float)
Scale the image to an absolute size.
public virtual Image ScaleAbsolute(float fitWidth, float fitHeight)
Parameters
fitWidth
floatthe new absolute width of the image
fitHeight
floatthe new absolute height of the image
Returns
- Image
this element
Remarks
Scale the image to an absolute size. This method will not preserve the width-height ratio of the image.
ScaleToFit(float, float)
Scale the image to an absolute size.
public virtual Image ScaleToFit(float fitWidth, float fitHeight)
Parameters
fitWidth
floatthe new maximum width of the image
fitHeight
floatthe new maximum height of the image
Returns
- Image
this element
Remarks
Scale the image to an absolute size. This method will preserve the width-height ratio of the image.
SetAutoScale(bool)
Sets the autoscale property for both width and height.
public virtual Image SetAutoScale(bool autoScale)
Parameters
autoScale
boolwhether or not to let the image resize automatically
Returns
- Image
this image
SetAutoScaleHeight(bool)
Sets the autoscale property for the height of the image.
public virtual Image SetAutoScaleHeight(bool autoScale)
Parameters
autoScale
boolwhether or not to let the image height resize automatically
Returns
- Image
this image
Remarks
Sets the autoscale property for the height of the image. Is currently bugged and will not work as expected.
SetAutoScaleWidth(bool)
Sets the autoscale property for the width of the image.
public virtual Image SetAutoScaleWidth(bool autoScale)
Parameters
autoScale
boolwhether or not to let the image width resize automatically
Returns
- Image
this image
SetFixedPosition(int, float, float)
Sets values for a absolute repositioning of the Element, on a specific page.
public virtual Image SetFixedPosition(int pageNumber, float left, float bottom)
Parameters
pageNumber
intthe page where the element must be positioned
left
floathorizontal position on the page
bottom
floatvertical position on the page
Returns
- Image
this Element.
Remarks
Sets values for a absolute repositioning of the Element, on a specific page. Also has as a side effect that the Element's POSITION is changed to fixed.
SetFixedPosition(float, float)
Sets values for a absolute repositioning of the Element.
public virtual Image SetFixedPosition(float left, float bottom)
Parameters
Returns
- Image
this image.
Remarks
Sets values for a absolute repositioning of the Element. Also has as a side effect that the Element's POSITION is changed to fixed.
SetHeight(float)
Sets the height property of the image, measured in points.
public virtual Image SetHeight(float height)
Parameters
height
floata value measured in points.
Returns
- Image
this image.
SetHeight(UnitValue)
Sets the height property of the image with a UnitValue.
public virtual Image SetHeight(UnitValue height)
Parameters
height
UnitValuea value measured in points.
Returns
- Image
this image.
SetMarginBottom(float)
Sets the bottom margin width of the image.
public virtual Image SetMarginBottom(float value)
Parameters
value
floatthe new bottom margin width
Returns
- Image
this image
SetMarginLeft(float)
Sets the left margin width of the element.
public virtual Image SetMarginLeft(float value)
Parameters
value
floatthe new left margin width
Returns
- Image
this element
SetMarginRight(float)
Sets the right margin width of the image.
public virtual Image SetMarginRight(float value)
Parameters
value
floatthe new right margin width
Returns
- Image
this image
SetMarginTop(float)
Sets the top margin width of the image.
public virtual Image SetMarginTop(float value)
Parameters
value
floatthe new top margin width
Returns
- Image
this image
SetMargins(float, float, float, float)
Sets the margins around the image to a series of new widths.
public virtual Image SetMargins(float marginTop, float marginRight, float marginBottom, float marginLeft)
Parameters
marginTop
floatthe new margin top width
marginRight
floatthe new margin right width
marginBottom
floatthe new margin bottom width
marginLeft
floatthe new margin left width
Returns
- Image
this image
SetMaxHeight(float)
Sets the max-height property of the image, measured in points.
public virtual Image SetMaxHeight(float maxHeight)
Parameters
maxHeight
floata value measured in points.
Returns
- Image
this image.
SetMaxHeight(UnitValue)
Sets the max-height property of the image with a UnitValue.
public virtual Image SetMaxHeight(UnitValue maxHeight)
Parameters
maxHeight
UnitValuea value measured in points.
Returns
- Image
this image.
SetMaxWidth(float)
Sets the max-width property of the image, measured in points.
public virtual Image SetMaxWidth(float maxWidth)
Parameters
maxWidth
floata value measured in points.
Returns
- Image
this image.
SetMaxWidth(UnitValue)
Sets the max-width property of the image with a UnitValue.
public virtual Image SetMaxWidth(UnitValue maxWidth)
Parameters
maxWidth
UnitValuea value measured in points.
Returns
- Image
this image.
SetMinHeight(float)
Sets the min-height property of the image, measured in points.
public virtual Image SetMinHeight(float minHeight)
Parameters
minHeight
floata value measured in points.
Returns
- Image
this image.
SetMinHeight(UnitValue)
Sets the min-height property of the image with a UnitValue.
public virtual Image SetMinHeight(UnitValue minHeight)
Parameters
minHeight
UnitValuea value measured in points.
Returns
- Image
this image.
SetMinWidth(float)
Sets the min-width property of the image, measured in points.
public virtual Image SetMinWidth(float minWidth)
Parameters
minWidth
floata value measured in points.
Returns
- Image
this image.
SetMinWidth(UnitValue)
Sets the min-width property of the image with a UnitValue.
public virtual Image SetMinWidth(UnitValue minWidth)
Parameters
minWidth
UnitValuea value measured in points.
Returns
- Image
this image.
SetNeutralRole()
Give this element a neutral role.
public virtual Image SetNeutralRole()
Returns
- Image
this Element
Remarks
Give this element a neutral role. See also SetRole(string).
SetObjectFit(ObjectFit)
Sets an object-fit mode for the image.
public virtual Image SetObjectFit(ObjectFit objectFit)
Parameters
Returns
- Image
this image
SetPadding(float)
Sets all paddings around the image to the same width.
public virtual Image SetPadding(float commonPadding)
Parameters
commonPadding
floatthe new padding width
Returns
- Image
this image
SetPaddingBottom(float)
Sets the bottom padding width of the image.
public virtual Image SetPaddingBottom(float value)
Parameters
value
floatthe new bottom padding width
Returns
- Image
this image
SetPaddingLeft(float)
Sets the left padding width of the image.
public virtual Image SetPaddingLeft(float value)
Parameters
value
floatthe new left padding width
Returns
- Image
this image
SetPaddingRight(float)
Sets the right padding width of the image.
public virtual Image SetPaddingRight(float value)
Parameters
value
floatthe new right padding width
Returns
- Image
this image
SetPaddingTop(float)
Sets the top padding width of the image.
public virtual Image SetPaddingTop(float value)
Parameters
value
floatthe new top padding width
Returns
- Image
this image
SetPaddings(float, float, float, float)
Sets the paddings around the image to a series of new widths.
public virtual Image SetPaddings(float paddingTop, float paddingRight, float paddingBottom, float paddingLeft)
Parameters
paddingTop
floatthe new padding top width
paddingRight
floatthe new padding right width
paddingBottom
floatthe new padding bottom width
paddingLeft
floatthe new padding left width
Returns
- Image
this image
SetRotationAngle(double)
Sets the rotation radAngle.
public virtual Image SetRotationAngle(double radAngle)
Parameters
radAngle
doublea value in radians
Returns
- Image
this element
SetWidth(float)
Sets the width property of the image, measured in points.
public virtual Image SetWidth(float width)
Parameters
width
floata value measured in points.
Returns
- Image
this image.
SetWidth(UnitValue)
Sets the width property of the image with a UnitValue.
public virtual Image SetWidth(UnitValue width)
Parameters
Returns
- Image
this image.