<!--
{
  "documentType" : "article",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/cgpdfscanner",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CGPDFScanner"
}
-->

# CGPDFScanner

A parser object for handling content and operators in a PDF content stream.

## Discussion

You can set up the PDF scanner object to invoke callbacks when it encounters specific PDF operators in the stream.

This object is not derived from `CFType`. In Objective-C, use [`CGPDFScannerRetain(_:)`](/documentation/CoreGraphics/CGPDFScannerRetain(_:)) and [`CGPDFScannerRelease(_:)`](/documentation/CoreGraphics/CGPDFScannerRelease(_:)) to manage the retain count of [`CGPDFScannerRef`](/documentation/CoreGraphics/CGPDFScannerRef) instances; do not use <doc://com.apple.documentation/documentation/CoreFoundation/CFRetain> and <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease>.

## Topics

### Creating a PDF Scanner Object

[`CGPDFScannerCreate`](/documentation/CoreGraphics/CGPDFScannerCreate(_:_:_:))

Creates a PDF scanner.

### Retaining and Releasing PDF Scanner Objects

[`CGPDFScannerRetain`](/documentation/CoreGraphics/CGPDFScannerRetain(_:))

Increments the retain count of a scanner object.

[`CGPDFScannerRelease`](/documentation/CoreGraphics/CGPDFScannerRelease(_:))

Decrements the retain count of a scanner object.

### Parsing Content

[`CGPDFScannerScan`](/documentation/CoreGraphics/CGPDFScannerScan(_:))

Parses the content stream of a PDF scanner object.

[`CGPDFScannerGetContentStream`](/documentation/CoreGraphics/CGPDFScannerGetContentStream(_:))

Returns the content stream associated with a PDF scanner object.

### Getting PDF Objects from the Scanner Stack

[`CGPDFScannerPopObject`](/documentation/CoreGraphics/CGPDFScannerPopObject(_:_:))

Retrieves an object from the scanner stack.

[`CGPDFScannerPopBoolean`](/documentation/CoreGraphics/CGPDFScannerPopBoolean(_:_:))

Retrieves a Boolean object from the scanner stack.

[`CGPDFScannerPopInteger`](/documentation/CoreGraphics/CGPDFScannerPopInteger(_:_:))

Retrieves an integer object from the scanner stack.

[`CGPDFScannerPopNumber`](/documentation/CoreGraphics/CGPDFScannerPopNumber(_:_:))

Retrieves a real value object from the scanner stack.

[`CGPDFScannerPopName`](/documentation/CoreGraphics/CGPDFScannerPopName(_:_:))

Retrieves a character string from the scanner stack.

[`CGPDFScannerPopString`](/documentation/CoreGraphics/CGPDFScannerPopString(_:_:))

Retrieves a string object from the scanner stack.

[`CGPDFScannerPopArray`](/documentation/CoreGraphics/CGPDFScannerPopArray(_:_:))

Retrieves an array object from the scanner stack.

[`CGPDFScannerPopDictionary`](/documentation/CoreGraphics/CGPDFScannerPopDictionary(_:_:))

Retrieves a PDF dictionary object from the scanner stack.

[`CGPDFScannerPopStream`](/documentation/CoreGraphics/CGPDFScannerPopStream(_:_:))

Retrieves a PDF stream object from the scanner stack.

### Data Types

[`CGPDFScannerRef`](/documentation/CoreGraphics/CGPDFScannerRef)

A type used to parse a PDF content stream.

## See Also

  [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)