Skip to main content

CreatePictureForm

Creates a picture form with the specified picture form properties.

Syntax

expression.CreatePictureForm(formPr);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
formPrRequiredPictureFormPrPicture form properties.

Returns

ApiPictureForm

Example

This example creates a picture form with the common and specific picture form properties.

// How to create a picture form and add it to the paragraph.

// Add the ApiPictureForm object to the document to upload a photo and set its image by a URL.

let doc = Api.GetDocument();
let pictureForm = Api.CreatePictureForm({"key": "Personal information", "tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50});
let paragraph = doc.GetElement(0);
paragraph.AddElement(pictureForm);
pictureForm.SetImage("https://api.onlyoffice.com/content/img/docbuilder/examples/user-profile.png");