Instance Method

selectionFromPoint:toPoint:

Returns the text between the two specified points in page space.

Declaration

iOS, Mac Catalyst
- (PDFSelection *)selectionFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint;
macOS
- (PDFSelection *)selectionFromPoint:(NSPoint)startPoint toPoint:(NSPoint)endPoint;

Discussion

Either point may be the one closer to the start of the page. In determining the selection, the points are sorted first top to bottom and then left to right.

Page space is a 72 dpi coordinate system with the origin at the lower-left corner of the current page.

To visualize the selection, picture the rectangle defined by startPoint and endPoint. The selection begins at the first character fully within the defined rectangle and closest to its upper-left corner. The selection ends at the last character fully within the defined rectangle and closest to its lower-right corner.

See Also

Working with Selections

- selectionForRect:

Returns the text enclosed within the specified rectangle, expressed in page (user) coordinates.

- selectionForWordAtPoint:

Returns the whole word that includes the specified point.

- selectionForLineAtPoint:

Returns the whole line of text that includes the specified point.

- selectionForRange:

Returns the text contained within the specified range.