Table of Contents

Class ImageElement

Namespace
EvoPdf
Assembly
evohtmltopdf.dll

Objects of this class can be added to a PDF document to render images

[ClassInterface(ClassInterfaceType.AutoDual)]
public class ImageElement : PageGraphicElement
Inheritance
ImageElement
Inherited Members

Constructors

ImageElement()

Constructs an empty image element. The InitPdfImage method must be called after construction to initialize the image element

public ImageElement()

ImageElement(float, float, Image)

Creates an ImageElement object from the specified System.Drawing.Image object 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.

public ImageElement(float x, float y, Image imageObj)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

imageObj Image

The image object

ImageElement(float, float, float, Image)

Creates an ImageElement object from the specified System.Drawing.Image object that will be rendered at the position (x,y) with the specified width destWidth and the height auto determined to keep the aspect ratio.

public ImageElement(float x, float y, float destWidth, Image imageObj)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

destWidth float

The destination rectangle width

imageObj Image

The image object

ImageElement(float, float, float, float, bool, Image)

Creates an ImageElement object from the specified System.Drawing.Image object that will be rendered at the position (x,y) with the (destWidth,destHeight) size.

public ImageElement(float x, float y, float destWidth, float destHeight, bool keepAspectRatio, Image imageObj)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

destWidth float

The destination rectangle width

destHeight float

The destination rectangle height

keepAspectRatio bool

A flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF

imageObj Image

The image object

ImageElement(float, float, float, float, bool, string)

Creates an ImageElement from the specified file that will be rendered at the position (x,y) with the (destWidth,destHeight) size.

public ImageElement(float x, float y, float destWidth, float destHeight, bool keepAspectRatio, string filePath)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

destWidth float

The destination rectangle width

destHeight float

The destination rectangle height

keepAspectRatio bool

A flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF

filePath string

The image file path

ImageElement(float, float, float, float, Image)

Creates an ImageElement object from the specified System.Drawing.Image object that will be rendered at the position (x,y) with the (destWidth,destHeight) size keeping the aspect ratio.

public ImageElement(float x, float y, float destWidth, float destHeight, Image imageObj)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

destWidth float

The destination rectangle width

destHeight float

The destination rectangle height

imageObj Image

The image object

ImageElement(float, float, float, float, string)

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.

public ImageElement(float x, float y, float destWidth, float destHeight, string filePath)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

destWidth float

The destination rectangle width

destHeight float

The destination rectangle height

filePath string

The image file path

ImageElement(float, float, float, string)

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.

public ImageElement(float x, float y, float destWidth, string filePath)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

destWidth float

The destination rectangle width

filePath string

The image file path

ImageElement(float, float, string)

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.

public ImageElement(float x, float y, string filePath)

Parameters

x float

The X location where this element will be rendered

y float

The Y location where this element will be rendered

filePath string

The image file path

Properties

DestHeight

Gets or sets the image destination height in PDF page

public float DestHeight { get; set; }

Property Value

float

DestWidth

Gets or sets the image destination width in PDF page

public float DestWidth { get; set; }

Property Value

float

EnlargeEnabled

A flag indicating if the image can be enlarged if necessary to fit the destination in PDF. The default value of the property is true

public bool EnlargeEnabled { get; set; }

Property Value

bool

ImageObj

Gets the underlying image object

public Image ImageObj { get; }

Property Value

Image

InsertNewPagesMode

A 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

public bool InsertNewPagesMode { get; set; }

Property Value

bool

KeepAspectRatio

A flag indicating if the aspect ratio of the image should be kept when the image is rendered in PDF. The default value of the property is true

public bool KeepAspectRatio { get; set; }

Property Value

bool

Paginate

When this property true the element can be paginated and rendered in many PDF pages

public bool Paginate { get; set; }

Property Value

bool

RenderMultiFrame

Set this property to enable/disable multi-frame images rendering when necessary

public bool RenderMultiFrame { get; set; }

Property Value

bool

RenderTransparentImage

A 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.

public bool RenderTransparentImage { get; set; }

Property Value

bool

XLocation

Gets or sets the image element location on X in PDF page

public float XLocation { get; set; }

Property Value

float

YLocation

Gets or sets the image element location on Y in PDF page

public float YLocation { get; set; }

Property Value

float

Methods

InitPdfImage(float, float, float, float, bool, string)

Initializes an image element from a file. This method must be called on empty image elements

public void InitPdfImage(float x, float y, float width, float height, bool keepAspectRatio, string imageFile)

Parameters

x float

The image element X coordinate in points

y float

The image element Y coordinate in points

width float

The image element width in points

height float

The image element height in points

keepAspectRatio bool

A flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF

imageFile string

The full path of the image file

InitPdfImage(float, float, float, float, string)

Initializes an image element from a file keeping the aspect ratio. This method must be called on empty image elements

public void InitPdfImage(float x, float y, float width, float height, string imageFile)

Parameters

x float

The image element X coordinate in points

y float

The image element Y coordinate in points

width float

The image element width in points

height float

The image element height in points

imageFile string

The full path of the image file

InitPdfImage(float, float, float, string)

Initializes an image element from a file. This method must be called on empty image elements

public void InitPdfImage(float x, float y, float width, string imageFile)

Parameters

x float

The image element X coordinate in points

y float

The image element Y coordinate in points

width float

The image element width in points

imageFile string

The full path of the image file

Events

AfterRenderPdfPageEvent

The event is raised right after the Image Element finished PDF page rendering. The PDF page configuration like size, orientation, header or footer is already defined and cannot be changed. In the handler of this event PDF elements can be added in the foreground of the rendered PDF page.

public event AfterRenderPdfPageDelegate AfterRenderPdfPageEvent

Event Type

AfterRenderPdfPageDelegate

BeforeRenderPdfPageEvent

The event is raised right before the page is rendered by Image element. The PDF page configuration like size, orientation, header or footer is already defined and cannot be changed. In the handler of this event PDF elements can be added in the background of the PDF page to be rendered.

public event BeforeRenderPdfPageDelegate BeforeRenderPdfPageEvent

Event Type

BeforeRenderPdfPageDelegate

PrepareRenderPdfPageEvent

The event is raised after the Image element created the PDF page and before starting rendering it. In the handler of this event the PDF page configuration like size, orientation, header or footer can still be changed before starting rendering.

public event PrepareRenderPdfPageDelegate PrepareRenderPdfPageEvent

Event Type

PrepareRenderPdfPageDelegate