Table of Contents

Class Image

Namespace
iText.Layout.Element
Assembly
itext.layout.dll

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 ImageData

an 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 ImageData

an internal representation of the image resource

left float

a float value representing the horizontal offset of the lower left corner of the image

bottom float

a 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 ImageData

an internal representation of the image resource

left float

a float value representing the horizontal offset of the lower left corner of the image

bottom float

a float value representing the vertical offset of the lower left corner of the image

width float

a 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 PdfFormXObject

an 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 PdfFormXObject

an internal PdfFormXObject

left float

a float value representing the horizontal offset of the lower left corner of the form

bottom float

a 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 PdfImageXObject

an 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 PdfImageXObject

an internal PdfImageXObject

width float

a 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 PdfImageXObject

an internal PdfImageXObject

left float

a float value representing the horizontal offset of the lower left corner of the image

bottom float

a 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 PdfImageXObject

an internal PdfImageXObject

left float

a float value representing the horizontal offset of the lower left corner of the image

bottom float

a float value representing the vertical offset of the lower left corner of the image

width float

a float value

Fields

tagProperties

protected DefaultAccessibilityProperties tagProperties

Field Value

DefaultAccessibilityProperties

xObject

protected PdfXObject xObject

Field Value

PdfXObject

Methods

GetAccessibilityProperties()

public virtual AccessibilityProperties GetAccessibilityProperties()

Returns

AccessibilityProperties

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

UnitValue

the bottom margin width, as a UnitValue object

GetMarginLeft()

Gets the current left margin width of the element.

public virtual UnitValue GetMarginLeft()

Returns

UnitValue

the left margin width, as a UnitValue object

GetMarginRight()

Gets the current right margin width of the image.

public virtual UnitValue GetMarginRight()

Returns

UnitValue

the right margin width, as a UnitValue object

GetMarginTop()

Gets the current top margin width of the image.

public virtual UnitValue GetMarginTop()

Returns

UnitValue

the top margin width, as a UnitValue object

GetObjectFit()

Retrieves the ObjectFit mode for the image.

public virtual ObjectFit GetObjectFit()

Returns

ObjectFit

an object-fit mode for the image if it was set and default value FILL otherwise

GetPaddingBottom()

Gets the current bottom padding width of the image.

public virtual UnitValue GetPaddingBottom()

Returns

UnitValue

the bottom padding width, as a UnitValue object

GetPaddingLeft()

Gets the current left padding width of the image.

public virtual UnitValue GetPaddingLeft()

Returns

UnitValue

the left padding width, as a UnitValue object

GetPaddingRight()

Gets the current right padding width of the image.

public virtual UnitValue GetPaddingRight()

Returns

UnitValue

the right padding width, as a UnitValue object

GetPaddingTop()

Gets the current top padding width of the image.

public virtual UnitValue GetPaddingTop()

Returns

UnitValue

the top padding width, as a UnitValue object

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

PdfXObject

a PdfXObject

MakeNewRenderer()

protected override IRenderer MakeNewRenderer()

Returns

IRenderer

Scale(float, float)

Scale the image relative to its default size.

public virtual Image Scale(float horizontalScaling, float verticalScaling)

Parameters

horizontalScaling float

the horizontal scaling coefficient. default value 1 = 100%

verticalScaling float

the 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 float

the new absolute width of the image

fitHeight float

the 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 float

the new maximum width of the image

fitHeight float

the 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 bool

whether 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 bool

whether 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 bool

whether 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 int

the page where the element must be positioned

left float

horizontal position on the page

bottom float

vertical 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

left float

horizontal position on the page

bottom float

vertical position on the page

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 float

a 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 UnitValue

a 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 float

the 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 float

the 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 float

the 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 float

the 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 float

the new margin top width

marginRight float

the new margin right width

marginBottom float

the new margin bottom width

marginLeft float

the 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 float

a 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 UnitValue

a 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 float

a 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 UnitValue

a 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 float

a 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 UnitValue

a 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 float

a 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 UnitValue

a 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

objectFit ObjectFit

is the ObjectFit mode

Returns

Image

this image

SetPadding(float)

Sets all paddings around the image to the same width.

public virtual Image SetPadding(float commonPadding)

Parameters

commonPadding float

the 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 float

the 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 float

the 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 float

the 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 float

the 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 float

the new padding top width

paddingRight float

the new padding right width

paddingBottom float

the new padding bottom width

paddingLeft float

the new padding left width

Returns

Image

this image

SetRotationAngle(double)

Sets the rotation radAngle.

public virtual Image SetRotationAngle(double radAngle)

Parameters

radAngle double

a 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 float

a 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

width UnitValue

a UnitValue object

Returns

Image

this image.