CGPDFContentStream Reference

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

Overview

The CGPDFContentStreamRef opaque type provides access to the data that describes the appearance of a PDF page. A CGPDFContentStream object represents one or more PDF content streams for a page and their associated resource dictionaries. A PDF content stream is a sequential set of instructions that specifies how to paint items on a PDF page. A resource dictionary contains information needed by the content stream in order to decode the sequential instructions of the content stream.

CGPDFContentStream functions can retrieve both the content streams and the resource dictionaries associated with a PDF page.

This opaque type is not derived from CFType and therefore there are no functions for retaining and releasing it.

Functions by Task

Creating a PDF Content Stream Object

Getting Data from a PDF Content Stream Object

Retaining and Releasing a PDF Content Stream Object

Functions

CGPDFContentStreamCreateWithPage

Creates a content stream object from a PDF page object.

CGPDFContentStreamRef CGPDFContentStreamCreateWithPage (
   CGPDFPageRef page
);
Parameters
page

A PDF page object.

Return Value

A new CGPDFContentStream object. You are responsible for releasing this object by calling the function CGPDFContentStreamRelease.

Discussion

A CGPDFContentStream object can contain more than one PDF content stream. To retrieve an array of the PDF content streams in the object, call the function CGPDFContentStreamGetStreams. To obtain the resources associated with a CGPDFContentStream object, call the function CGPDFContentStreamGetResource.

Availability
  • Available in OS X version 10.4 and later.
Declared In
CGPDFContentStream.h

CGPDFContentStreamCreateWithStream

Creates a PDF content stream object from an existing PDF content stream object.

CGPDFContentStreamRef CGPDFContentStreamCreateWithStream (
   CGPDFStreamRef stream,
   CGPDFDictionaryRef streamResources,
   CGPDFContentStreamRef parent
);
Parameters
stream

The PDF stream you want to create a content stream from.

streamResources

A PDF dictionary that contains the resources associated with the stream you want to retrieve.

parent

The content stream of the page on which stream appears. Supply the parent parameter when you create a content stream that’s used within a page.

Return Value

A CGPDFContentStream object created from the stream parameter. You are responsible for releasing this object by calling the function CGPDFContentStreamRelease.

Discussion

You can use this function to get access to the contents of a form, pattern, Type3 font, or any PDF stream.

Availability
  • Available in OS X version 10.4 and later.
Declared In
CGPDFContentStream.h

CGPDFContentStreamGetResource

Gets the specified resource from a PDF content stream object.

CGPDFObjectRef CGPDFContentStreamGetResource (
   CGPDFContentStreamRef cs,
   const char *category,
   const char *name
);
Parameters
cs

A CGPDFContentStream object.

category

A string that specifies the category of the resource you want to obtain.

name

A string that specifies the name of the resource you want to obtain.

Return Value

The resource dictionary.

Discussion

You can use this function to obtain resources used by the content stream, such as forms, patterns, color spaces, and fonts.

Availability
  • Available in OS X version 10.4 and later.
Declared In
CGPDFContentStream.h

CGPDFContentStreamGetStreams

Gets the array of PDF content streams contained in a PDF content stream object.

CFArrayRef CGPDFContentStreamGetStreams (
   CGPDFContentStreamRef cs
);
Parameters
cs

A CGPDFContentStream object.

Return Value

The array of PDF content streams that make up the content stream object represented by the cs parameter.

Availability
  • Available in OS X version 10.4 and later.
Declared In
CGPDFContentStream.h

CGPDFContentStreamRelease

Decrements the retain count of a PDF content stream object.

void CGPDFContentStreamRelease (
   CGPDFContentStreamRef cs
);
Parameters
cs

A PDF content stream.

Availability
  • Available in OS X version 10.4 and later.
Declared In
CGPDFContentStream.h

CGPDFContentStreamRetain

Increments the retain count of a PDF content stream object.

CGPDFContentStreamRef CGPDFContentStreamRetain (
   CGPDFContentStreamRef cs
);
Parameters
cs

A PDF content stream.

Return Value

The same PDF content stream you passed in as the cs parameter.

Availability
  • Available in OS X version 10.4 and later.
Declared In
CGPDFContentStream.h

Data Types

CGPDFContentStreamRef

An opaque type that provides access to the data that describes the appearance of a PDF page.

typedef struct CGPDFContentStream *CGPDFContentStreamRef;
Availability
  • Available in OS X v10.4 and later.
Declared In
CGPDFContentStream.h