Class HtmlImageLoadEventArgs
Invoked when an image is about to be loaded by file path, URL or inline data in 'img' element or background-image CSS style.
Allows to overwrite the loaded image by providing the image object manually, or different source (file or URL) to load from.
Example: image 'src' can be non-valid string that is interpreted in the overwrite delegate by custom logic to resource image object
Example: image 'src' in the html is relative - the overwrite intercepts the load and provide full source URL to load the image from
Example: image download requires authentication - the overwrite intercepts the load, downloads the image to disk using custom code and
provide file path to load the image from. Can also use the asynchronous image overwrite not to block HTML rendering is applicable.
If no alternative data is provided the original source will be used.
Inheritance
Inherited Members
Namespace: TheArtOfDev.HtmlRenderer.Core.Entities
Assembly: Telerik.WinControls.RadMap.dll
Syntax
public sealed class HtmlImageLoadEventArgs : EventArgs
Properties
Attributes
collection of all the attributes that are defined on the image element or CSS style
Declaration
public Dictionary<string, string> Attributes { get; }
Property Value
System.Collections.Generic.Dictionary<System.String, System.String>
|
Handled
Indicate the image load is handled asynchronously.
Cancel this image loading and overwrite the image asynchronously using callback method.
Declaration
public bool Handled { get; set; }
Property Value
System.Boolean
|
Src
the source of the image (file path, URL or inline data)
Declaration
public string Src { get; }
Property Value
System.String
|
Methods
Callback()
Callback to overwrite the loaded image with error image.
Can be called directly from delegate handler or asynchronously after setting Handled to True.
Declaration
public void Callback()
Callback(Object)
Callback to overwrite the loaded image with given image object.
Can be called directly from delegate handler or asynchronously after setting Handled to True.
If imageRectangle is given (not Empty) then only the specified rectangle will
be used from the loaded image and not all of it, also the rectangle will be used for size and not the actual image size.
Declaration
public void Callback(object image)
Parameters
System.Object
image
the image to load |
Callback(Object, Double, Double, Double, Double)
Callback to overwrite the loaded image with given image object.
Can be called directly from delegate handler or asynchronously after setting Handled to True.
Only the specified rectangle (x,y,width,height) will be used from the loaded image and not all of it, also
the rectangle will be used for size and not the actual image size.
Declaration
public void Callback(object image, double x, double y, double width, double height)
Parameters
System.Object
image
the image to load |
System.Double
x
optional: limit to specific rectangle of the image and not all of it |
System.Double
y
optional: limit to specific rectangle of the image and not all of it |
System.Double
width
optional: limit to specific rectangle of the image and not all of it |
System.Double
height
optional: limit to specific rectangle of the image and not all of it |
Callback(String)
Callback to overwrite the loaded image with image to load from given URI.
Can be called directly from delegate handler or asynchronously after setting Handled to True.
Declaration
public void Callback(string path)
Parameters
System.String
path
the path to the image to load (file path or URL) |
Callback(String, Double, Double, Double, Double)
Callback to overwrite the loaded image with image to load from given URI.
Can be called directly from delegate handler or asynchronously after setting Handled to True.
Only the specified rectangle (x,y,width,height) will be used from the loaded image and not all of it, also
the rectangle will be used for size and not the actual image size.
Declaration
public void Callback(string path, double x, double y, double width, double height)
Parameters
System.String
path
the path to the image to load (file path or URL) |
System.Double
x
optional: limit to specific rectangle of the image and not all of it |
System.Double
y
optional: limit to specific rectangle of the image and not all of it |
System.Double
width
optional: limit to specific rectangle of the image and not all of it |
System.Double
height
optional: limit to specific rectangle of the image and not all of it |