Get Started
Plugins
Macros
More information

window.Asc.plugin.executeMethod ("GetImageDataFromSelection", callback)

Description

Defines the method that allows getting the image data from the first of the selected drawings. If there are no drawings selected, the method returns a white rectangle.

Usage

This method should be used in the following way:

window.Asc.plugin.executeMethod ("GetImageDataFromSelection");
Returns

The method returns the oImageData object containig the information about the base64 encoded png image:

{
    "src": string,
    "nWidth": number,
    "nHeight": number
}
Parameters
Parameter Description Type Example
src The image source in the base64 format. string "data:image/png;base64,image-in-the-base64-format"
nWidth The image width in pixels. number 300
nHeight The image height in pixels. number 200
Example
window.Asc.plugin.executeMethod ("GetImageDataFromSelection", [], function(oResult) {
    oImage = document.createElement("img");
    oImage.src = oResult.src;
    oImage.width = oResult.width;
    oImage.height = oResult.height;
    CreateImageEditor();
    initializationDone = true;
    var imageHeight = null;
    oImage.height > 500 ? imageHeight = 500 : imageHeight = oImage.height;
    window.Asc.plugin.resizeWindow(undefined, undefined, 870, imageHeight + 300, 0, 0);
});