Autofit text fields
Autofits all the text fields in the document.
(function () {
let doc = Api.GetDocument();
let width = 6 * 240;
let height = 2 * 240;
// Set AutoFit property to true for all text fields
doc.GetAllForms()
.filter(form => form.GetFormType() === "textForm")
.forEach(form => {
form.ToFixed(width, height);
form.SetAutoFit(true);
});
})();
Methods used: GetDocument, GetAllForms, GetFormType, ToFixed, SetAutoFit
Result