Class

PDFSelection

A PDFSelection object identifies a contiguous or noncontiguous selection of text in a PDF document.

Declaration

class PDFSelection : NSObject

Topics

Initializing a Selection

init(document: PDFDocument)

Returns an empty PDFSelection object.

Getting Information About a Selection

var pages: [PDFPage]

Returns the array of pages contained in the selection.

var string: String?

Returns an NSString object representing the text contained in the selection (may contain linefeed characters).

var attributedString: NSAttributedString?

Returns an NSAttributedString object representing the text contained in the selection (may contain linefeed characters).

func bounds(for: PDFPage) -> CGRect

Returns the bounds of the selection on the specified page.

func selectionsByLine() -> [PDFSelection]

Returns an array of selections, one for each line of text covered by the receiver.

var color: UIColor?

Sets the color used for the drawing of a selection in both active and inactive states.

Modifying a Selection

func add(PDFSelection)

Adds the specified selection to the receiving selection.

func add([PDFSelection])

Adds the specified array of selections to the receiving selection.

func extend(atEnd: Int)

Extends the selection from its end toward the end of the document.

func extend(atStart: Int)

Extends the selection from its start toward the beginning of the document.

Managing Selection Drawing

func draw(for: PDFPage, active: Bool)

Calls draw(for:with:active:) with a default value for box parameter.

func draw(for: PDFPage, with: PDFDisplayBox, active: Bool)

Draws the selection relative to the origin of the specified box in page space.

var color: UIColor?

Sets the color used for the drawing of a selection in both active and inactive states.

Relationships

Inherits From

See Also

Content Model

class PDFDocument

An object that represents PDF data or a PDF file and defines methods for writing, searching, and selecting PDF data.

class PDFPage

PDFPage, a subclass of NSObject, defines methods used to render PDF pages and work with annotations, text, and selections.

class PDFOutline

A PDFOutline object is an element in a tree-structured hierarchy that can represent the structure of a PDF document.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software