Table of Contents

Method AddImageDefinition

Namespace
vdWebLibrary
Assembly
JsPropertiesExtractor.dll

AddImageDefinition(string, string, ImageLoadedDelegate)

Adds a new Image Definition in the document. The function is running asynchronously, so you need to implement imageloadedCallback event/delegate to manage the method results

public object AddImageDefinition(string tablename, string urlpath, ImageLoadedDelegate imageloadedCallback)

Parameters

tablename string

The name the object will have in the images collection of the document.

urlpath string

The path from which the image will be loaded or the Data URL defining the image.

imageloadedCallback ImageLoadedDelegate

Will be called when the image loaded by the url path.

Returns

object

The inserted vdImage object, either the created one or the one contained in the collection.

Examples

In the example we add a new Image Definition, we insert in by using the scriptCommand.image methodand aftet it has been inserted we zoom to the extents of the drawing.

vdcanvas.AddImageDefinition("sampleImage", "sampleImage.png", function () {
vdcanvas.scriptCommand.image("sampleImage", "sampleImage.png", [[0, 0, 0], 1.0, 0], actionentityaddedimg)
});
function actionentityaddedimg(vdcanvas, entity) {
vdcanvas.zoomExtents(); setTimeout(vdcanvas.redraw); //post a redraw command }