PutImageDataToSelection

PutImageDataToSelection(oImageData)

Replaces the first selected drawing with the image specified in the parameters. If there are no drawings selected, the method inserts the image at the current position.

Parameters:

Name Type Description
oImageData ImageData

The information about the base64 encoded png image.

Returns:

This method doesn't return any data.

Example

Copy code
window.saveImage = function () {
    let sImageSrc = imageEditor.toDataURL ();
    let editorDimension = imageEditor.getCanvasSize ();
    let nWidth = editorDimension.width;
    let nHeight = editorDimension.height;
    let oImageData = {
        "src": sImageSrc,
        "width": nWidth,
        "height": nHeight
    };
    window.Asc.plugin.executeMethod ("PutImageDataToSelection", [oImageData]);
    window.Asc.plugin.executeCommand ("close", "");
};