<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPrintOperation/createContext()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPrintOperation(im)createContext"
  },
  "title" : "createContext()"
}
-->

# createContext()

Creates the graphics context object used for drawing during the operation.

```
func createContext() -> NSGraphicsContext?
```

## Return Value

The graphics context object used for drawing. This object is created using the settings from the receiver’s `NSPrintInfo` object.

## Discussion

Do not invoke this method directly—it is invoked before any output is generated.

---

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)