Class

PDFPage

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

Declaration

@interface PDFPage : NSObject

Overview

PDFPage objects are flexible and powerful. With them you can render PDF content onscreen or to a printer, add annotations, count characters, define selections, and get the textual content of a page as an NSString object.

Your application instantiates a PDFPage object by asking for one from a PDFDocument object.

For simple display and navigation of PDF documents within your application, you don’t need to use PDFPage. You need only use PDFView.

Topics

Initializing a Page

- initWithDocument:

Initializer for subclasses of PDFPage.

- initWithImage:

Creates a new PDFPage object and initializes it with the specified NSImage object.

Getting Information About a Page

document

Returns the PDFDocument object with which the page is associated.

label

Returns the label for the page.

- boundsForBox:

Returns the bounds for the specified PDF display box.

- setBounds:forBox:

Sets the bounds for the specified box.

rotation

Sets the rotation angle for the page in degrees.

Working with Annotations

annotations

Returns an array containing the page’s annotations.

displaysAnnotations

Returns a Boolean value indicating whether annotations are displayed for the page.

- addAnnotation:

Adds the specified annotation object to the page.

- removeAnnotation:

Removes the specified annotation from the page.

- annotationAtPoint:

Returns the annotation, if there is one, at the specified point.

Rendering Pages

- drawWithBox:

Draws the page within the specified box.

Deprecated
- transformContextForBox:

Transforms the current context, given the specified box.

Deprecated

Working with Textual Content

numberOfCharacters

Returns the number of characters on the page, including whitespace characters.

string

Returns an NSString object representing the text on the page.

attributedString

Returns an NSAttributedString object representing the text on the page.

- characterBoundsAtIndex:

Returns the bounds, in page space, of the character at the specified index.

- characterIndexAtPoint:

Returns the character index value for the specified point in page space.

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.

- selectionFromPoint:toPoint:

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

- selectionForRange:

Returns the text contained within the specified range.

Supporting Types

PDFDisplayBox

The following box types may be used with PDFPage drawing and bounds-setting methods. See the Adobe PDF Specification for more information on box types, units, and coordinate systems.

Initializers

Instance Properties

dataRepresentation

Returns the PDF data (that is, a PDF document) representing this page. This method does not preserve external page links.

Relationships

Inherits From

Conforms To

See Also

Content Model

PDFDocument

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

PDFOutline

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

PDFSelection

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