跳到主要内容

GetCharLimit

获取文本字段的字符限制。 <note> 字符限制为 0 表示字段没有字符限制

语法

expression.GetCharLimit();

expression - 表示 ApiTextField 类的变量。

参数

此方法没有任何参数。

返回值

number

示例

获取文本字段并显示其在 PDF 文档中的字符限制属性。

// How can I get the char limit using a text field in a PDF document?

// Get the char limit for a text field in a PDF document.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let textField = Api.CreateTextField([10, 10, 160, 30]);
page.AddObject(textField);

textField.SetCharLimit(20);
textField.SetValue('Char limit is: ' + textField.GetCharLimit());