SetImage
function SetImage(sImageSrc: string = null, nWidth: EMU = null, nHeight: EMU = null): boolean
Description
Sets an image to the current picture form.
Parameters
- sImageSrc
string
null The image source where the image to be inserted should be taken from (currently, only internet URL or base64 encoded images are supported).
The image width in English measure units.
The image height in English measure units.
Returns
boolean
Try It
var oDocument = Api.GetDocument();
var oPictureForm = Api.CreatePictureForm({"tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50});
oPictureForm.SetImage("https://api.onlyoffice.com/content/img/docbuilder/examples/user-profile.png");
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oPictureForm);