CPDFPage Class Reference

Inherits from NSObject
Declared in CPDFPage.h

Overview

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

CPDFPage is a logical representation of a PDF document’s page. Your application instantiates a CPDFPage object by asking for one from a CPDFDocument object. For simple display and navigation of PDF documents within your application, you don’t need to use CPDFPage. You need only use CPDFView.

  document

Returns the CPDFDocument object with which the page is associated.

@property (nonatomic, readonly) CPDFDocument *document

Discussion

Returns the CPDFDocument object with which the page is associated.

Declared In

CPDFPage.h

  label

Returns the label for the page.

@property (nonatomic, readonly) NSString *label

Discussion

Returns the label for the page.

Typically, the label is “1” for the first page, “2” for the second page, and so on, but nonnumerical labels are also possible (such as “xxi”, “4-1” and so on).

Declared In

CPDFPage.h

– boundsForBox:

Returns the bounds for the specified PDF display box.

- (CGRect)boundsForBox:(CPDFDisplayBox)box

Discussion

Returns the bounds for the specified PDF display box.

See Also

Declared In

CPDFPage.h

– setBounds:forBox:

Sets the bounds for the specified box.

- (void)setBounds:(CGRect)bounds forBox:(CPDFDisplayBox)box

Discussion

Sets the bounds for the specified box.

If the box does not exist, this method creates it for you.

See Also

Declared In

CPDFPage.h

  rotation

Sets the rotation angle for the page in degrees.

@property (nonatomic, assign) NSInteger rotation

Discussion

Sets the rotation angle for the page in degrees.

Rotation on a page. Must be 0, 90, 180 or 270 (negative rotations will be “normalized” to one of 0, 90, 180 or 270). Some PDF’s have an inherent rotation and so -[rotation] may be non-zero when a PDF is first opened.

Declared In

CPDFPage.h

  bounds

@property (nonatomic, readonly) CGRect bounds

  size

Returns the size of page after rotation.

@property (nonatomic, readonly) CGSize size

Discussion

Returns the size of page after rotation.

Declared In

CPDFPage.h

  annotations

Returns an array containing the page’s annotations.

@property (nonatomic, readonly) NSArray<CPDFAnnotation*> *annotations

Discussion

Returns an array containing the page’s annotations.

The elements of the array will most likely be typed to subclasses of the CPDFAnnotation class.

Declared In

CPDFPage.h

– addAnnotation:

Adds the specified annotation object to the page.

- (void)addAnnotation:(CPDFAnnotation *)annotation

Discussion

Adds the specified annotation object to the page.

Declared In

CPDFPage.h

– removeAnnotation:

Removes the specified annotation from the page.

- (void)removeAnnotation:(CPDFAnnotation *)annotation

Discussion

Removes the specified annotation from the page.

Declared In

CPDFPage.h

– removeAllAnnotations

Removes all annotations from the page.

- (void)removeAllAnnotations

Discussion

Removes all annotations from the page.

Declared In

CPDFPage.h

– annotationAtPoint:

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

- (CPDFAnnotation *)annotationAtPoint:(CGPoint)point

Discussion

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

Use this method for hit-testing based on the current cursor position. If more than one annotation shares the specified point, the frontmost (or topmost) one is returned (the annotations are searched in reverse order of their appearance in the PDF data file). Returns NULL if there is no annotation at point. Specify the point in page space. Page space is a coordinate system with the origin at the lower-left corner of the current page.

Declared In

CPDFPage.h

– annotation:atPoint:

- (BOOL)annotation:(CPDFAnnotation *)annotation atPoint:(CGPoint)point

– transform

This transform correctly rotates and offsets based on the given page’s rotation property.

- (CGAffineTransform)transform

Discussion

This transform correctly rotates and offsets based on the given page’s rotation property.

Declared In

CPDFPage.h

– thumbnailOfSize:

Convenience function that returns an image of this page, with annotations.

- (CPDFKitPlatformImage *)thumbnailOfSize:(CGSize)size

Discussion

Convenience function that returns an image of this page, with annotations.

Declared In

CPDFPage.h

– findEditString:withOptions:

Page number search for content editing*

- (NSArray<NSArray<CPDFSelection*> *> *)findEditString:(NSString *)string withOptions:(CPDFSearchOptions)options

Discussion

Page number search for content editing*

Declared In

CPDFPage.h

  numberOfCharacters

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

@property (nonatomic, readonly) NSUInteger numberOfCharacters

Discussion

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

Number of characters on the page (including linefeeds and spaces inserted).

Declared In

CPDFPage.h

– characterBoundsAtIndex:

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

- (CGRect)characterBoundsAtIndex:(NSInteger)index

Discussion

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

In the unlikely event that there is more than one character at the specified index point, only the bounds of the first character is returned. Page space is a coordinate system with the origin at the lower-left corner of the current page. Note that the bounds returned are not guaranteed to have integer coordinates.

Declared In

CPDFPage.h

– characterIndexAtPoint:

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

- (NSInteger)characterIndexAtPoint:(CGPoint)point

Discussion

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

Returns the index of the first character if multiple characters are at this point. If there is no character at the specified point, the method returns -1. Page space is a coordinate system with the origin at the lower-left corner of the current page.

Declared In

CPDFPage.h

  string

Returns an NSString object representing the text on the page.

@property (nonatomic, readonly) NSString *string

Discussion

Returns an NSString object representing the text on the page.

String (with linefeeds and in some cases spaces inserted) representing the text on the page.

Declared In

CPDFPage.h

– stringForRect:

Returns the text enclosed within the specified rectangle, expressed in page coordinates.

- (NSString *)stringForRect:(CGRect)rect

Discussion

Returns the text enclosed within the specified rectangle, expressed in page coordinates.

Given a rect in page-space, returns a selection representing enclosed text on page.

Declared In

CPDFPage.h

– stringForRange:

Returns the text enclosed within the specified range.

- (NSString *)stringForRange:(NSRange)range

Discussion

Returns the text enclosed within the specified range.

Declared In

CPDFPage.h

– stringForLocation:length:

Returns the text enclosed within the specified range.

- (NSString *)stringForLocation:(NSUInteger)location length:(NSUInteger)length

Discussion

Returns the text enclosed within the specified range.

Declared In

CPDFPage.h

– selectionForRange:

Returns the text contained within the specified range.

- (CPDFSelection *)selectionForRange:(NSRange)range

Discussion

Returns the text contained within the specified range.

Given a range, returns a selection representing text within that range. Will clamp any range that goes out of bounds. Will return NULL for an empty selection.

Declared In

CPDFPage.h

– applyRedactions

Applies redaction annotations in the page.

- (void)applyRedactions

Discussion

Applies redaction annotations in the page.

Declared In

CPDFPage.h