iOS Developer Library

Developer

ApplicationServices Framework Reference CGPDFPage Reference

Options
Deployment Target:

On This Page
Language:

CGPDFPage Reference

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

Functions

  • Increments the retain count of a PDF page.

    Declaration

    Objective-C

    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.

    Import Statement

    Availability

    Available in iOS 2.0 and later.

  • Decrements the retain count of a PDF page.

    Declaration

    Objective-C

    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.

    Import Statement

    Availability

    Available in iOS 2.0 and later.

  • Returns the CFType ID for PDF page objects.

    Declaration

    Swift

    func CGPDFPageGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CGPDFPageGetTypeID ( void );

    Return Value

    Returns the Core Foundation type for a PDF page.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

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

    Declaration

    Swift

    func CGPDFPageGetBoxRect(_ page: CGPDFPage!, _ box: CGPDFBox) -> CGRect

    Objective-C

    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.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

  • Returns the dictionary of a PDF page.

    Declaration

    Swift

    func CGPDFPageGetDictionary(_ page: CGPDFPage!) -> CGPDFDictionaryRef

    Objective-C

    CGPDFDictionaryRef CGPDFPageGetDictionary ( CGPDFPageRef page );

    Parameters

    page

    A PDF page.

    Return Value

    Returns the PDF dictionary for the specified page.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

  • Returns the document for a page.

    Declaration

    Swift

    func CGPDFPageGetDocument(_ page: CGPDFPage!) -> CGPDFDocument!

    Objective-C

    CGPDFDocumentRef CGPDFPageGetDocument ( CGPDFPageRef page );

    Parameters

    page

    A PDF page.

    Return Value

    The PDF document with which the specified page is associated.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

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

    Declaration

    Swift

    func CGPDFPageGetDrawingTransform(_ page: CGPDFPage!, _ box: CGPDFBox, _ rect: CGRect, _ rotate: Int32, _ preserveAspectRatio: Bool) -> CGAffineTransform

    Objective-C

    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:

    • Computes the effective rectangle by intersecting the rectangle associated with box and the /MediaBox entry of the specified page.

    • Rotates the effective rectangle according to the page’s /Rotate entry.

    • Centers the resulting rectangle on rect. If the value of the rotate parameter is non-zero, then the rectangle is rotated clockwise by rotate degrees. The value of rotate must be a multiple of 90.

    • Scales the rectangle, if necessary, so that it coincides with the edges of rect. If the value of preserveAspectRatio parameter is true, then the final rectangle coincides with the edges of rect only in the more restrictive dimension.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

  • Returns the page number of the specified PDF page.

    Declaration

    Swift

    func CGPDFPageGetPageNumber(_ page: CGPDFPage!) -> UInt

    Objective-C

    size_t CGPDFPageGetPageNumber ( CGPDFPageRef page );

    Parameters

    page

    A PDF page.

    Return Value

    Returns the page number of the specified page.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

  • Returns the rotation angle of a PDF page.

    Declaration

    Swift

    func CGPDFPageGetRotationAngle(_ page: CGPDFPage!) -> Int32

    Objective-C

    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.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

Data Types

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

    Declaration

    Swift

    typealias CGPDFPageRef = CGPDFPage

    Objective-C

    typedef struct CGPDFPage *CGPDFPageRef;

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.

Constants

  • Box types for a PDF page.

    Declaration

    Swift

    struct CGPDFBox { init(_ value: UInt32) var value: UInt32 }

    Objective-C

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

    Constants

    • kCGPDFMediaBox

      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 iOS 2.0 and later.

    • kCGPDFCropBox

      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 iOS 2.0 and later.

    • kCGPDFBleedBox

      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 iOS 2.0 and later.

    • kCGPDFTrimBox

      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 iOS 2.0 and later.

    • kCGPDFArtBox

      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 iOS 2.0 and later.

    Import Statement

    import CoreGraphics

    Availability

    Available in iOS 2.0 and later.