Next Page > Hide TOC

CGPDFPage Reference

Derived from
Framework
ApplicationServices/ApplicationServices.h
Companion guide
Declared in
CGPDFPage.h

Overview

The CGPDFPageRef opaque type represents a page in a PDF document.

Functions by Task

Retaining and Releasing a PDF Page

Getting the CFType ID

Getting Page Information

Functions

CGPDFPageGetBoxRect

Returns the rectangle that represents a type of box for a content region or page dimensions of a PDF page.

CGRect CGPDFPageGetBoxRect (
   CGPDFPageRef page,
   CGPDFBox box
);

Parameters
page

A PDF page.

box

A CGPDFBox constant that specifies the type of box. For possible values, see “PDF Boxes”.

Return Value

Returns the rectangle associated with the type of box specified by the box parameter in the specified page.

Discussion

Returns the rectangle associated with the specified box in the specified page. This is the value of the corresponding entry (such as /MediaBox, /ArtBox, and so on) in the page’s dictionary.

Availability
Related Sample Code
Declared In
CGPDFPage.h

CGPDFPageGetDictionary

Returns the dictionary of a PDF page.

CGPDFDictionaryRef CGPDFPageGetDictionary (
   CGPDFPageRef page
);

Parameters
page

A PDF page.

Return Value

Returns the PDF dictionary for the specified page.

Availability
Declared In
CGPDFPage.h

CGPDFPageGetDocument

Returns the document for a page.

CGPDFDocumentRef CGPDFPageGetDocument (
   CGPDFPageRef page
);

Parameters
page

A PDF page.

Return Value

The PDF document with which the specified page is associated.

Availability
Declared In
CGPDFPage.h

CGPDFPageGetDrawingTransform

Returns the affine transform that maps a box to a given rectangle on a PDF page.

CGAffineTransform CGPDFPageGetDrawingTransform (
   CGPDFPageRef page,
   CGPDFBox box,
   CGRect rect,
   int rotate,
   bool preserveAspectRatio
);

Parameters
page

A PDF page.

box

A CGPDFBox constant that specifies the type of box. For possible values, see “PDF Boxes”.

rect

A Quartz rectangle.

rotate

An integer, that must be a multiple of 90, that specifies the angle by which the specified rectangle is rotated clockwise.

preserveAspectRatio

A Boolean value that specifies whether or not the aspect ratio should be preserved. A value of true specifies that the aspect ratio should be preserved.

Return Value

An affine transform that maps the box specified by the box parameter to the rectangle specified by the rect parameter.

Discussion

Quartz constructs the affine transform as follows:

Availability
Declared In
CGPDFPage.h

CGPDFPageGetPageNumber

Returns the page number of the specified PDF page.

size_t CGPDFPageGetPageNumber (
   CGPDFPageRef page
);

Parameters
page

A PDF page.

Return Value

Returns the page number of the specified page.

Availability
Declared In
CGPDFPage.h

CGPDFPageGetRotationAngle

Returns the rotation angle of a PDF page.

int CGPDFPageGetRotationAngle (
   CGPDFPageRef page
);

Parameters
page

A PDF page.

Return Value

The rotation angle (in degrees) of the specified page. This is the value of the /Rotate entry in the page’s dictionary.

Availability
Declared In
CGPDFPage.h

CGPDFPageGetTypeID

Returns the CFType ID for PDF page objects.

CFTypeID CGPDFPageGetTypeID (
   void
);

Return Value

Returns the Core Foundation type for a PDF page.

Availability
Declared In
CGPDFPage.h

CGPDFPageRelease

Decrements the retain count of a PDF page.

void CGPDFPageRelease (
   CGPDFPageRef page
);

Parameters
page

A PDF page.

Discussion

This function is equivalent to CFRelease, except that it does not cause an error if the page parameter is NULL.

Availability
Declared In
CGPDFPage.h

CGPDFPageRetain

Increments the retain count of a PDF page.

CGPDFPageRef CGPDFPageRetain (
   CGPDFPageRef page
);

Parameters
page

A PDF page.

Return Value

The same page you passed in as the page parameter.

Discussion

This function is equivalent to CFRetain, except that it does not cause an error if the page parameter is NULL.

Availability
Declared In
CGPDFPage.h

Data Types

CGPDFPageRef

An opaque type that represents a page in a PDF document.

typedef struct CGPDFPage *CGPDFPageRef;

Availability
Declared In
CGPDFPage.h

Constants

PDF Boxes

Box types for a PDF page.

enum CGPDFBox {
   kCGPDFMediaBox = 0,
   kCGPDFCropBox = 1,
   kCGPDFBleedBox = 2,
   kCGPDFTrimBox = 3,
   kCGPDFArtBox = 4
};
typedef enum CGPDFBox CGPDFBox;

Constants
kCGPDFMediaBox

The page media box—a rectangle, expressed in default user space units, that defines the boundaries of the physical medium on which the page is intended to be displayed or printed

Available in Mac OS X v10.3 and later.

Declared in CGPDFPage.h.

kCGPDFCropBox

The page crop box—a rectangle, expressed in default user space units, that defines the visible region of default user space. When the page is displayed or printed, its contents are to be clipped to this rectangle.

Available in Mac OS X v10.3 and later.

Declared in CGPDFPage.h.

kCGPDFBleedBox

The page bleed box—a rectangle, expressed in default user space units, that defines the region to which the contents of the page should be clipped when output in a production environment

Available in Mac OS X v10.3 and later.

Declared in CGPDFPage.h.

kCGPDFTrimBox

The page trim box—a rectangle, expressed in default user space units, that defines the intended dimensions of the finished page after trimming.

Available in Mac OS X v10.3 and later.

Declared in CGPDFPage.h.

kCGPDFArtBox

The page art box—a rectangle, expressed in default user space units, defining the extent of the page’s meaningful content (including potential white space) as intended by the page’s creator.

Available in Mac OS X v10.3 and later.

Declared in CGPDFPage.h.

Declared In
CGPDFPage.h

Next Page > Hide TOC


© 2003, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-04-08)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.