| Inherits from | |
| Conforms to | |
| Framework | Library/Frameworks/Quartz.framework/Frameworks/PDFKit.framework |
| Availability | Available in Mac OS X v10.4 and later. |
| Declared in | PDFSelection.h |
| Related sample code |
A PDFSelection object identifies a contiguous or noncontiguous selection of text in a PDF document.
Adds the specified selection to the receiving selection.
- (void)addSelection:(PDFSelection *)selection
Selections do not have to be contiguous. If the selection to be added overlaps with the receiving selection, the overlap is removed in a process called normalization.
PDFSelection.hAdds the specified array of selections to the receiving selection.
- (void)addSelections:(NSArray *)selections
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.
– addSelection:PDFSelection.hReturns an NSAttributedString object representing the text contained in the selection (may contain linefeed characters).
- (NSAttributedString *)attributedString
PDFSelection.hReturns the bounds of the selection on the specified page.
- (NSRect)boundsForPage:(PDFPage *)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.
PDFSelection.hReturns the color used to draw the selection.
- (NSColor *)color
Note that when no color has been specified for the PDFSelection objects in a document, the selections are drawn using [NSColor selectedTextBackgroundColor] for the active state and [NSColor secondarySelectedControlColor] for the inactive state.
– setColor:PDFSelection.hCalls drawForPage:withBox:active: with a default value for box parameter.
- (void)drawForPage:(PDFPage *)page active:(BOOL)active
The default value is kPDFDisplayBoxCropBox. If active is YES, drawing uses selectedTextBackgroundColor. If NO, it uses secondarySelectedControlColor.
PDFSelection.hDraws the selection relative to the origin of the specified box in page space.
- (void)drawForPage:(PDFPage *)page withBox:(PDFDisplayBox)box active:(BOOL)active
The selection is drawn using the current highlight color. If active is YES, drawing uses selectedTextBackgroundColor. If NO, 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.
PDFSelection.hExtends the selection from its end toward the end of the document.
- (void)extendSelectionAtEnd:(NSInteger)chars
The selection may be extended by any amount, up to and including the end of the document.
PDFSelection.hExtends the selection from its start toward the beginning of the document.
- (void)extendSelectionAtStart:(NSInteger)chars
The selection may be extended by any amount, up to and including the beginning of the document.
PDFSelection.hReturns an empty PDFSelection object.
- (id)initWithDocument:(PDFDocument *)document
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.
PDFSelection.hReturns the array of pages contained in the selection.
- (NSArray *)pages
Pages are sorted by index number.
PDFSelection.hReturns an array of selections, one for each line of text covered by the receiver.
- (NSArray *)selectionsByLine
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.
PDFSelection.hSets the color used for the drawing of a selection in both active and inactive states.
- (void)setColor:(NSColor *)color
When no color has been specified for the PDFSelection objects in a document, the selections are drawn using [NSColor selectedTextBackgroundColor] for the active state and [NSColor secondarySelectedControlColor] for the inactive state. Use the setColor method to supply a color you want to be used for the drawing of both active and inactive selections.
– colorPDFSelection.hReturns an NSString object representing the text contained in the selection (may contain linefeed characters).
- (NSString *)string
– attributedStringPDFSelection.hLast updated: 2007-12-11