Mac Developer Library

Developer

ApplicationServices Framework Reference CGPDFObject Reference

Options
Deployment Target:

On This Page
Language:

CGPDFObject Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreGraphics

Objective-C

@import CoreGraphics;

The CGPDFObjectRef opaque type represents PDF objects in a PDF document. PDF supports several basic types of object: Boolean values, integer and real numbers, strings, names, arrays, dictionaries, and streams. Most of these are represented in Quartz by corresponding specific types. A CGPDFObject can represent any of these types. You use CGPDFObject functions to determine the type of the object, and retrieve the object value if it is of an expected type.

This opaque type is not derived from CFType and therefore there are no functions for retaining and releasing it. CGPDFObject objects exist as constituent parts of a CGPDFDocument object, and are managed by their container.

Functions

  • Returns the PDF type identifier of an object.

    Declaration

    Swift

    func CGPDFObjectGetType(_ object: CGPDFObjectRef) -> CGPDFObjectType

    Objective-C

    CGPDFObjectType CGPDFObjectGetType ( CGPDFObjectRef object );

    Parameters

    object

    A PDF object. If the value if not a PDF object, the behavior is unspecified.

    Return Value

    Returns the type of the object parameter. See Data Types.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

  • Returns whether an object is of a given type and if it is, retrieves its value.

    Declaration

    Swift

    func CGPDFObjectGetValue(_ object: CGPDFObjectRef, _ type: CGPDFObjectType, _ value: UnsafeMutablePointer<Void>) -> Bool

    Objective-C

    bool CGPDFObjectGetValue ( CGPDFObjectRef object, CGPDFObjectType type, void *value );

    Parameters

    object

    A PDF object.

    type

    A PDF object type.

    value

    If the object parameter is a PDF object of the specified type, then on return contains that object, otherwise the value is unspecified.

    Return Value

    Returns true if the specified object is a PDF object of the specified type, otherwise false.

    Discussion

    The function gets the value of the object parameter. If the type of object is equal to the type specified, then:

    • If the value parameter is not a null pointer, then the value of object is copied to value, and the function returns true.

    • If the value parameter is a null pointer, then the function simply returns true. This allows you to test whether object is of the type specified.

    If the type of object is kCGPDFObjectTypeInteger and type is equal to kCGPDFObjectTypeReal, then the value of object is converted to floating point, the result copied to value, and the function returns true. If none of the preceding conditions is met, returns false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X version 10.3 and later.

Data Types

  • An opaque type that contains information about a PDF object.

    Declaration

    Swift

    typealias CGPDFObjectRef = COpaquePointer

    Objective-C

    typedef union CGPDFObject *CGPDFObjectRef;

    Availability

    Available in OS X v10.3 and later.

  • A PDF Boolean value.

    Declaration

    Swift

    typealias CGPDFBoolean = UInt8

    Objective-C

    typedef unsigned char CGPDFBoolean;

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A PDF integer value.

    Declaration

    Swift

    typealias CGPDFInteger = Int

    Objective-C

    typedef long int CGPDFInteger;

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

  • A PDF real value.

    Declaration

    Swift

    typealias CGPDFReal = CGFloat

    Objective-C

    typedef CGFloat CGPDFReal;

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.

Constants

  • Types of PDF object.

    Declaration

    Swift

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

    Objective-C

    enum CGPDFObjectType { kCGPDFObjectTypeNull = 1, kCGPDFObjectTypeBoolean, kCGPDFObjectTypeInteger, kCGPDFObjectTypeReal, kCGPDFObjectTypeName, kCGPDFObjectTypeString, kCGPDFObjectTypeArray, kCGPDFObjectTypeDictionary, kCGPDFObjectTypeStream };typedef enum CGPDFObjectType CGPDFObjectType;

    Constants

    • kCGPDFObjectTypeNull

      kCGPDFObjectTypeNull

      The type for a PDF null.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeBoolean

      kCGPDFObjectTypeBoolean

      The type for a PDF Boolean.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeInteger

      kCGPDFObjectTypeInteger

      The type for a PDF integer.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeReal

      kCGPDFObjectTypeReal

      The type for a PDF real.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeName

      kCGPDFObjectTypeName

      Type for a PDF name.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeString

      kCGPDFObjectTypeString

      The type for a PDF string.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeArray

      kCGPDFObjectTypeArray

      Type for a PDF array.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeDictionary

      kCGPDFObjectTypeDictionary

      The type for a PDF dictionary.

      Available in OS X v10.3 and later.

    • kCGPDFObjectTypeStream

      kCGPDFObjectTypeStream

      The type for a PDF stream.

      Available in OS X v10.3 and later.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.3 and later.