CGPDFScanner Reference

Derived from
None
Framework
ApplicationServices/ApplicationServices.h
Companion guide
Declared in
CGPDFScanner.h

Overview

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 by Task

Creating a PDF Scanner Object

Retaining and Releasing PDF Scanner Objects

Parsing Content

Getting PDF Objects from the Scanner Stack

Functions

CGPDFScannerCreate

Creates a PDF scanner.

CGPDFScannerRef CGPDFScannerCreate (
   CGPDFContentStreamRef cs,
   CGPDFOperatorTableRef table,
   void *info
);
Parameters
cs

A PDF content stream object. (See CGPDFContentStream Reference.)

table

A table of callbacks for the PDF operators you want to handle.

info

A pointer to data you want passed to your callback function. (See CGPDFOperatorTable Reference.)

Return Value

A PDF scanner object. You are responsible for releasing this object by calling the function CGPDFScannerRelease.

Discussion

When you want to parse the contents of the PDF stream, call the function CGPDFScannerScan.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerGetContentStream

Returns the content stream associated with a PDF scanner object.

CGPDFContentStreamRef CGPDFScannerGetContentStream (
   CGPDFScannerRef scanner
);
Parameters
scanner

The scanner object whose content stream you want to obtain.

Return Value

The content stream associated with scanner.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopArray

Retrieves an array object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopBoolean

Retrieves a Boolean object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopDictionary

Retrieves a PDF dictionary object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopInteger

Retrieves an integer object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopName

Retrieves a character string from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopNumber

Retrieves a real value object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopObject

Retrieves an object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopStream

Retrieves a PDF stream object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerPopString

Retrieves a string object from the scanner stack.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerRelease

Decrements the retain count of a scanner object.

void CGPDFScannerRelease (
   CGPDFScannerRef scanner
);
Parameters
scanner

The scanner object to release.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerRetain

Increments the retain count of a scanner object.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

CGPDFScannerScan

Parses the content stream of a PDF scanner object.

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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h

Data Types

CGPDFScannerRef

An opaque type used to parse a PDF content stream.

typedef struct CGPDFScanner *CGPDFScannerRef;
Availability
  • Available in iOS 2.0 and later.
Declared In
CGPDFScanner.h