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("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oDrawing = Api.CreateImage("https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", 60 * 36000, 35 * 36000);
oParagraph.AddDrawing(oDrawing);
builder.SaveFile("docx", "CreateImage.docx");
builder.CloseFile();

Resulting document