跳到主要内容

SetSelection

设置页面选择。

语法

expression.SetSelection(startPoint, endPoint);

expression - 表示 ApiPage 类的变量。

参数

名称必需/可选数据类型默认值描述
startPoint必需Point选区的起始点。
endPoint必需Point选区的结束点。

返回值

boolean

示例

在 PDF 的页面上将特定文本区域标记为已选中。

// How do I highlight a range of text on a page in a PDF?

// Define and activate a text selection within given coordinates in a PDF.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
page.SetSelection({x: 10, y: 10}, {x: 100, y: 100});
console.log('We selected the text on the page');