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
CGPDFBoxconstant 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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageGetDictionary
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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageGetDocument
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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageGetDrawingTransform
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
CGPDFBoxconstant 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
truespecifies 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:
Computes the effective rectangle by intersecting the rectangle associated with
boxand the/MediaBoxentry of the specified page.Rotates the effective rectangle according to the page’s
/Rotateentry.Centers the resulting rectangle on
rect. If the value of therotateparameter is non-zero, then the rectangle is rotated clockwise by rotate degrees. The value ofrotatemust be a multiple of 90.Scales the rectangle, if necessary, so that it coincides with the edges of
rect. If the value ofpreserveAspectRatioparameter istrue, then the final rectangle coincides with the edges ofrectonly in the more restrictive dimension.
Availability
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageGetPageNumber
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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageGetRotationAngle
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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageGetTypeID
Returns the CFType ID for PDF page objects.
CFTypeID CGPDFPageGetTypeID ( void );
Return Value
Returns the Core Foundation type for a PDF page.
Availability
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageRelease
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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hCGPDFPageRetain
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
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hData Types
CGPDFPageRef
An opaque type that represents a page in a PDF document.
typedef struct CGPDFPage *CGPDFPageRef;
Availability
- Available in OS X v10.3 and later.
Declared In
CGPDFPage.hConstants
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
kCGPDFMediaBoxThe 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 OS X v10.3 and later.
Declared in
CGPDFPage.h.kCGPDFCropBoxThe 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 OS X v10.3 and later.
Declared in
CGPDFPage.h.kCGPDFBleedBoxThe 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 OS X v10.3 and later.
Declared in
CGPDFPage.h.kCGPDFTrimBoxThe page trim box—a rectangle, expressed in default user space units, that defines the intended dimensions of the finished page after trimming.
Available in OS X v10.3 and later.
Declared in
CGPDFPage.h.kCGPDFArtBoxThe 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 OS X v10.3 and later.
Declared in
CGPDFPage.h.
Declared In
CGPDFPage.h© 2003, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-04-08)