Platforms to show: All Mac Windows Linux Cross-Platform

Back to PDFSelectionMBS class.

PDFSelectionMBS.addSelection(selection as PDFSelectionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 8.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Add a selection to this selection.

Selections do not have to be contiguous. If the selection added overlaps with this selection, overlaps are removed.

PDFSelectionMBS.addSelections(selection() as PDFSelectionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Adds the specified array of selections to the receiving selection.

This method provides better performance than multiple calls to addSelection if you need to add several selections to an existing selection. This is because the normalization of the selection (the removal of any overlaps between selections) occurs only once, after all selections have been added.
Available in Mac OS X v10.5 and later.

PDFSelectionMBS.boundsForPage(page as PDFPageMBS) as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the bounds of the selection on the specified page.

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

Some examples using this method:

PDFSelectionMBS.Constructor(doc as PDFDocumentMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an empty PDFSelection object.

Typically, you don't need to create a PDFSelection object, but you can use an empty PDFSelection object as a container into which you can place selections, using addSelection: and addSelections.
Available in Mac OS X v10.5 and later.

See also:

PDFSelectionMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 20.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new object based on a given PDFSelection handle.

Please pass in a non zero handle which points to a PDFSelection object.
For use with declares.

See also:

PDFSelectionMBS.copy as PDFSelectionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a copy of the selection object.

PDFSelectionMBS.drawForPage(page as PDFPageMBS, active as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Calls drawForPage with a default value for box parameter.

The default value is kPDFDisplayBoxCropBox. If active is true, drawing uses selectedTextBackgroundColor. If false, it uses secondarySelectedControlColor.

See also:

PDFSelectionMBS.drawForPage(page as PDFPageMBS, box as Integer, active as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Draws the selection relative to the origin of the specified box in page space.

The selection is drawn using the current highlight color. If active is true, drawing uses selectedTextBackgroundColor. If false, it uses secondarySelectedControlColor. Refer to the PDFPage class for the list of available box types.

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

See also:

PDFSelectionMBS.extendSelectionAtEnd(chars as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 8.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Extends the selection at either end.
Example
dim s as PDFSelectionMBS // your selection

s.extendSelectionAtEnd(50)

Selections can be extended right off onto neighboring pages even to include the entire PDF document.

Some examples using this method:

PDFSelectionMBS.extendSelectionAtStart(chars as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 8.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Extends the selection at either end.
Example
dim s as PDFSelectionMBS // your selection

s.extendSelectionAtStart(50)

Selections can be extended right off onto neighboring pages even to include the entire PDF document.

Some examples using this method:

PDFSelectionMBS.extendSelectionForLineBoundaries

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 21.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Extend to the selection to the beginning and end of the currently selected lines of text.

If the current selection is on a single line, then this will extend it to the entire line width. If the selection is across multiple lines, then the first and last lines are expected to wholly contain their respective rows of text.

Available in macOS 10.13 or newer or iOS 11.0 or newer.

PDFSelectionMBS.numberOfTextRangesOnPage(page as PDFPageMBS) as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the number of contiguous ranges of text on the specified page.

Returns zero if page is not in selection.
A typical, simple selection will contain a single range of text.

Available in Mac OS X 10.7 and later.

PDFSelectionMBS.pages as PDFPageMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 8.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Array of pages covered by the selection.

These are sorted by page index.
Returns nil on any error.

PDFSelectionMBS.rangeAtIndex(page as PDFPageMBS, index as Integer) as NSRangeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a range of contiguous text at index on the specified page.

A simple selection. A typical, simple selection will contain a single range of text.
Available in Mac OS X 10.7 and later.

PDFSelectionMBS.selectionsByLine as PDFSelectionMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method PDFKit MBS PDFKit Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of selections, one for each line of text covered by the receiver.

If you call this method on a PDFSelection object that represents a paragraph, for example, selectionsByLine returns an array that contains one PDFSelection object for each line of text in the paragraph.
Available in Mac OS X v10.5 and later.

The items on this page are in the following plugins: MBS PDFKit Plugin.


The biggest plugin in space...