Constructor
new Widget()
Examples
let pdfDoc; // PDFDoc实例
let pdfPage = await pdfDoc.getPageByIndex(0);
let annots = await pdfPage.getAnnots();
let widget = annots[0]; // 获取第一个注释,假设它是一个Widget注释
let pdfDoc; // PDFDoc实例
let pdfForm = await pdfDoc.loadPDFForm();
let pdfField = await pdfForm.getField('fieldName');
let widget = await pdfField.getWidget();
Extends
Methods
getBorderStyle() → {Promise.<number>}
- Description:
- 获取注释的边框样式。
- Inherited From:
Returns:
边框样式,参考 Constants.Border_Style 中定义的常量值
- Type
- Promise.<number>
getControl()
- Description:
- 获取注释的表单控件。
- Deprecated:
- 请使用 Widget#getField 代替。
(async) getDefaultAppearance() → {Promise.<DefaultAppearance>}
- Description:
- 获取注释的默认外观。
Returns:
默认外观对象。
- Type
- Promise.<DefaultAppearance>
getField() → {PDFField}
- Description:
- 获取注释的表单域。
Returns:
表单域对象。
- Type
- PDFField
getId() → {number}
- Description:
- 获取注释的ID。是 Annot#getObjectNumber 的别名。
- Inherited From:
Returns:
注释的ID
- Type
- number
(async) getMKBorderColor() → {Promise.<(number|undefined)>}
- Description:
- 获取注释的边框颜色。
Returns:
返回表单控件的边框颜色。颜色表示为0xRRGGBB格式的32位整数,如果未设置则返回undefined。
- Type
- Promise.<(number|undefined)>
(async) getMKFillColor() → {Promise.<(number|undefined)>}
- Description:
- 获取注释的填充颜色。
Returns:
返回表单控件的填充颜色。颜色表示为0xRRGGBB格式的32位整数,如果未设置则返回undefined。
- Type
- Promise.<(number|undefined)>
getObjectNumber() → {number}
- Description:
- 获取注释的ID。
- Inherited From:
Returns:
注释的ID
- Type
- number
getPage() → {PDFPage}
- Description:
- 获取注释所属的PDFPage对象。
- Inherited From:
Returns:
返回注释所属的PDFPage对象
- Type
- PDFPage
getType() → {Constants.Annot_Type}
- Description:
- 获取注释的类型。
- Inherited From:
Returns:
注释类型
- Type
- Constants.Annot_Type
(async) setBorderStyle(borderStyle, styleParam) → {Promise.<void>}
- Description:
- 设置注释的边框样式。
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
borderStyle |
number | 边框样式,参考 Constants.Border_Style 中定义的常量值 |
styleParam |
number | Array.<number> | 一个表示云朵强度的数字,或一个表示虚线模式的数组。 |
Returns:
- Type
- Promise.<void>
(async) setContent(content) → {Promise.<void>}
- Description:
- 设置注释的内容。
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | 注释内容字符串 |
Returns:
- Type
- Promise.<void>
(async) setDefaultAppearance(defaultAppearance) → {Promise.<void>}
- Description:
- 设置注释的默认外观。
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
defaultAppearance |
Object | 默认外观对象
Properties
|
Returns:
- Type
- Promise.<void>
(async) setMKBorderColor(color) → {Promise.<void>}
- Description:
- 设置注释的边框颜色。
Parameters:
| Name | Type | Description |
|---|---|---|
color |
number | undefined | 表单控件的边框颜色。颜色表示为0xRRGGBB格式的32位整数,或`undefined`以删除边界颜色。 |
Returns:
- Type
- Promise.<void>
(async) setMKFillColor(color) → {Promise.<void>}
- Description:
- 设置注释的边框颜色。
Parameters:
| Name | Type | Description |
|---|---|---|
color |
number | undefined | 表单控件的填充颜色。颜色表示为0xRRGGBB格式的32位整数,或`undefined`以删除填充颜色。 |
Returns:
- Type
- Promise.<void>
(async) setRect(rect) → {Promise.<void>}
- Description:
- 设置注释的矩形区域。
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
rect |
Rect | 矩形区域对象 |
Returns:
- Type
- Promise.<void>