CreateImage

function CreateImage(sImageSrc: string = null, nWidth: EMU = null, nHeight: EMU = null): ApiImage

Description

Creates an image with the parameters specified.

Parameters

sImageSrcstringdefault: null

The image source where the image to be inserted should be taken from (currently, only internet URL or Base64 encoded images are supported).

nWidthEMUdefault: null

The image width in English measure units.

nHeightEMUdefault: null

The image height in English measure units.

Returns

ApiImage

Try It

var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
var oShape = Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/step2_1.png", 300 * 36000, 150 * 36000);
oSlide.AddObject(oShape);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).