Skip to main content

SetSelection

Sets page selection.

Syntax

expression.SetSelection(startPoint, endPoint);

expression - A variable that represents a ApiPage class.

Parameters

NameRequired/OptionalData typeDefaultDescription
startPointRequiredPointThe start point of the selection.
endPointRequiredPointThe end point of the selection.

Returns

boolean

Example

Mark a specific area of text as selected on a page in a 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');