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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
imageObj
ImageThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
destWidth
floatThe destination rectangle width
imageObj
ImageThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
destWidth
floatThe destination rectangle width
destHeight
floatThe destination rectangle height
keepAspectRatio
boolA flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF
imageObj
ImageThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
destWidth
floatThe destination rectangle width
destHeight
floatThe destination rectangle height
keepAspectRatio
boolA flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF
filePath
stringThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
destWidth
floatThe destination rectangle width
destHeight
floatThe destination rectangle height
imageObj
ImageThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
destWidth
floatThe destination rectangle width
destHeight
floatThe destination rectangle height
filePath
stringThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
destWidth
floatThe destination rectangle width
filePath
stringThe 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
floatThe X location where this element will be rendered
y
floatThe Y location where this element will be rendered
filePath
stringThe image file path
Properties
DestHeight
Gets or sets the image destination height in PDF page
public float DestHeight { get; set; }
Property Value
DestWidth
Gets or sets the image destination width in PDF page
public float DestWidth { get; set; }
Property Value
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
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
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
Paginate
When this property true the element can be paginated and rendered in many PDF pages
public bool Paginate { get; set; }
Property Value
RenderMultiFrame
Set this property to enable/disable multi-frame images rendering when necessary
public bool RenderMultiFrame { get; set; }
Property Value
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
XLocation
Gets or sets the image element location on X in PDF page
public float XLocation { get; set; }
Property Value
YLocation
Gets or sets the image element location on Y in PDF page
public float YLocation { get; set; }
Property Value
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
floatThe image element X coordinate in points
y
floatThe image element Y coordinate in points
width
floatThe image element width in points
height
floatThe image element height in points
keepAspectRatio
boolA flag indicating if the aspect ratio of the image is kept when the image is rendered in PDF
imageFile
stringThe 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
floatThe image element X coordinate in points
y
floatThe image element Y coordinate in points
width
floatThe image element width in points
height
floatThe image element height in points
imageFile
stringThe 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
floatThe image element X coordinate in points
y
floatThe image element Y coordinate in points
width
floatThe image element width in points
imageFile
stringThe 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
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
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