Mac Developer Library

Developer

ApplicationServices Framework Reference CGPDFScanner Reference

Options
Deployment Target:

On This Page
Language:

CGPDFScanner Reference

The CGPDFScannerRef opaque type is used to parse a PDF content stream. You can set up the PDF scanner object to invoke callbacks when it encounters specific PDF operators in the stream.

This opaque type is not derived from CFType. Use CGPDFScannerRetain and CGPDFScannerRelease to manage the retain count of CGPDFScannerRef instances; do not use CFRetain and CFRelease.

Functions

  • Increments the retain count of a scanner object.

    Declaration

    Objective-C

    CGPDFScannerRef CGPDFScannerRetain ( CGPDFScannerRef scanner );

    Parameters

    scanner

    The scanner object to retain.

    Return Value

    The same scanner object passed to the function in the scanner parameter.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Availability

    Available in OS X v10.4 and later.

  • Decrements the retain count of a scanner object.

    Declaration

    Objective-C

    void CGPDFScannerRelease ( CGPDFScannerRef scanner );

    Parameters

    scanner

    The scanner object to release.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Availability

    Available in OS X v10.4 and later.

  • Parses the content stream of a PDF scanner object.

    Declaration

    Swift

    func CGPDFScannerScan(_ scanner: CGPDFScanner!) -> Bool

    Objective-C

    bool CGPDFScannerScan ( CGPDFScannerRef scanner );

    Parameters

    scanner

    The scanner object whose content stream you want to parse.

    Return Value

    true if the entire stream is parsed successfully; false if parsing fails (for example, if the stream data is corrupted).

    Discussion

    The function CGPDFScannerScan parses the PDF content stream associated with the scanner. Each time Quartz parses a PDF operator for which you register a callback, Quartz invokes your callback.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Returns the content stream associated with a PDF scanner object.

    Declaration

    Swift

    func CGPDFScannerGetContentStream(_ scanner: CGPDFScanner!) -> CGPDFContentStream!

    Objective-C

    CGPDFContentStreamRef CGPDFScannerGetContentStream ( CGPDFScannerRef scanner );

    Parameters

    scanner

    The scanner object whose content stream you want to obtain.

    Return Value

    The content stream associated with scanner.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves an object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopObject(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFObjectRef>) -> Bool

    Objective-C

    bool CGPDFScannerPopObject ( CGPDFScannerRef scanner, CGPDFObjectRef *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the object popped from the scanner stack.

    Return Value

    true if the object is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves a Boolean object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopBoolean(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFBoolean>) -> Bool

    Objective-C

    bool CGPDFScannerPopBoolean ( CGPDFScannerRef scanner, CGPDFBoolean *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the PDF Boolean object popped from the scanner stack.

    Return Value

    true if the boolean object is retrieved successfully; otherwise,false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves an integer object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopInteger(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFInteger>) -> Bool

    Objective-C

    bool CGPDFScannerPopInteger ( CGPDFScannerRef scanner, CGPDFInteger *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the PDF integer object popped from the scanner stack.

    Return Value

    true if the PDF integer is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves a real value object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopNumber(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFReal>) -> Bool

    Objective-C

    bool CGPDFScannerPopNumber ( CGPDFScannerRef scanner, CGPDFReal *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the real value object popped from the scanner stack.

    Return Value

    true if the real value is retrieved successfully; otherwise, false.

    Discussion

    The number retrieved from the scanner can be a real value or an integer value. However, the result is always converted to a value of type CGPDFReal.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves a character string from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopName(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<UnsafePointer<Int8>>) -> Bool

    Objective-C

    bool CGPDFScannerPopName ( CGPDFScannerRef scanner, const char **value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the character string popped from the scanner stack.

    Return Value

    true if the string is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves a string object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopString(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFStringRef>) -> Bool

    Objective-C

    bool CGPDFScannerPopString ( CGPDFScannerRef scanner, CGPDFStringRef *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the string object popped from the scanner stack.

    Return Value

    true if the string is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves an array object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopArray(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFArrayRef>) -> Bool

    Objective-C

    bool CGPDFScannerPopArray ( CGPDFScannerRef scanner, CGPDFArrayRef *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the PDF array object popped from the scanner stack.

    Return Value

    true if the array object is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves a PDF dictionary object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopDictionary(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFDictionaryRef>) -> Bool

    Objective-C

    bool CGPDFScannerPopDictionary ( CGPDFScannerRef scanner, CGPDFDictionaryRef *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the PDF dictionary object popped from the scanner stack.

    Return Value

    true if the PDF dictionary object is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

  • Retrieves a PDF stream object from the scanner stack.

    Declaration

    Swift

    func CGPDFScannerPopStream(_ scanner: CGPDFScanner!, _ value: UnsafeMutablePointer<CGPDFStreamRef>) -> Bool

    Objective-C

    bool CGPDFScannerPopStream ( CGPDFScannerRef scanner, CGPDFStreamRef *value );

    Parameters

    scanner

    A valid scanner object.

    value

    On output, points to the PDF stream object popped from the scanner stack.

    Return Value

    true if the stream object is retrieved successfully; otherwise, false.

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.

Data Types

  • An opaque type used to parse a PDF content stream.

    Declaration

    Swift

    typealias CGPDFScannerRef = CGPDFScanner

    Objective-C

    typedef struct CGPDFScanner *CGPDFScannerRef;

    Import Statement

    Objective-C

    @import CoreGraphics;

    Swift

    import CoreGraphics

    Availability

    Available in OS X v10.4 and later.