TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

CreateImage

CreateImage(sImageSrc, nWidth, nHeight) → { ApiImage }

Creates an image with the parameters specified.

Parameters:

Name Type Description
sImageSrc string

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

nWidth EMU

The image width in English measure units.

nHeight EMU

The image height in English measure units.

Returns:

Type
ApiImage

Example

Copy code
builder.CreateFile("pptx");
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);
builder.SaveFile("pptx", "CreateImage.pptx");
builder.CloseFile();

Resulting document