跳到主要内容

IsReadOnly

检查字段是否为只读

语法

expression.IsReadOnly();

expression - 表示 ApiBaseField 类的变量。

参数

此方法没有任何参数。

返回值

boolean

示例

检查 PDF 中的表单字段是否已锁定以防止编辑。

// How can I determine if a form field is read-only in a PDF?

// Verify the read-only status of a form field in a PDF.

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

textField.SetValue('Read only is: ' + textField.IsReadOnly());