---
title: "selection(from:at:to:at:)"
framework: pdfkit
role: symbol
role_heading: Instance Method
path: "pdfkit/pdfdocument/selection(from:at:to:at:)"
---

# selection(from:at:to:at:)

Returns the specified selection based on starting and ending points.

## Declaration

```swift
func selection(from startPage: PDFPage, at startPoint: CGPoint, to endPage: PDFPage, at endPoint: CGPoint) -> PDFSelection?
```

```swift
func selection(from startPage: PDFPage, at startPoint: NSPoint, to endPage: PDFPage, at endPoint: NSPoint) -> PDFSelection?
```

## Discussion

Discussion The selection begins at startPt on startPage and ends at endPt on endPage. The starting and ending points should be specified in page space, relative to their respective pages. The starting and ending points can be on the same page. In this case, invoking this method is equivalent to sending the selectionFromPoint:toPoint: message to a PDFPage object. Page space is a 72 dpi coordinate system with the origin at the lower-left corner of the current page.

## See Also

### Related Documentation

- [selection(for:)](pdfkit/pdfpage/selection(for:)-20y9d.md)

### Working with Selections and Searches

- [selection(from:atCharacterIndex:to:atCharacterIndex:)](pdfkit/pdfdocument/selection(from:atcharacterindex:to:atcharacterindex:).md)
- [selectionForEntireDocument](pdfkit/pdfdocument/selectionforentiredocument.md)
- [Search Operations](pdfkit/search-operations.md)
