CGPDFOperatorTable Reference

Derived from
None
Framework
ApplicationServices/ApplicationServices.h
Declared in
CGPDFOperatorTable.h

Overview

A CGPDFOperatorTable object stores callback functions for PDF operators. You pass an operator table and a PDF content stream to a CGPDFScanner object. When the scanner parses a PDF operator, Quartz invokes your callback for that operator. See also CGPDFScanner Reference and CGPDFContentStream Reference.

For more about PDF operators, see the latest version of PDF Reference, Adobe Systems Incorporated.

Functions by Task

Creating a PDF Operator Table

Setting Callback Functions

Retaining and Releasing a PDF Operator Table

Functions

CGPDFOperatorTableCreate

Creates an empty PDF operator table.

CGPDFOperatorTableRef CGPDFOperatorTableCreate (
   void
);
Return Value

An empty PDF operator table. You are responsible for releasing this object by calling CGPDFOperatorTableRelease.

Discussion

Call the function CGPDFOperatorTableSetCallback to fill the operator table with callbacks.

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

CGPDFOperatorTableRelease

Decrements the retain count of a CGPDFOperatorTable object.

void CGPDFOperatorTableRelease (
   CGPDFOperatorTableRef table
);
Parameters
table

A PDF operator table.

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

CGPDFOperatorTableRetain

Increments the retain count of a CGPDFOperatorTable object.

CGPDFOperatorTableRef CGPDFOperatorTableRetain (
   CGPDFOperatorTableRef table
);
Parameters
table

A PDF operator table.

Return Value

The same PDF operator table you passed in as the table parameter.

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

CGPDFOperatorTableSetCallback

Sets a callback function for a PDF operator.

void CGPDFOperatorTableSetCallback (
   CGPDFOperatorTableRef table,
   const char *name,
   CGPDFOperatorCallback callback
);
Parameters
table

A PDF operator table.

name

The name of the PDF operator you want to set a callback for.

callback

The callback to invoke for the PDF operator specified by the name parameter.

Discussion

You call the function CGPDFOperatorTableSetCallback for each PDF operator for which you want to provide a callback. See Appendix A in the PDF Reference, Second Edition, version 1.3, Adobe Systems Incorporated for a summary of PDF operators.

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

Callbacks

CGPDFOperatorCallback

Performs custom processing for PDF operators.

typedef void (*CGPDFOperatorCallback)(
   CGPDFScannerRef scanner,
   void *info
);

If you name your function MyCGPDFOperatorCallback, you would declare it like this:

void MyCGPDFOperatorCallback (
   CGPDFScannerRef scanner,
   void *info
);

Parameters
scanner

A CGPDFScanner object. Quartz passes the scanner to your callback function. The scanner contains the PDF content stream that has the PDF operator that corresponds to this callback.

info

A pointer to data passed to the callback.

Discussion

Your callback function takes any action that’s appropriate for your application. For example, if you want to count the number of inline images in a PDF but ignore the image data, you would set a callback for the EI operator. In your callback you would increment a counter for each call.

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

Data Types

CGPDFOperatorTableRef

An opaque type that stores callback functions for PDF operators.

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