---
title: "PMCreateSession(_:)"
framework: applicationservices
role: symbol
role_heading: Function
path: applicationservices/1463247-pmcreatesession
---

# PMCreateSession(_:)

Creates and initializes a printing session object and creates a context for printing operations.

## Declaration

```swift
func PMCreateSession(_ printSession: UnsafeMutablePointer<PMPrintSession?>) -> OSStatus
```

## Parameters

- `printSession`: A pointer to your doc://com.apple.documentation/documentation/applicationservices/pmprintsession variable. On return, the variable refers to a new printing session object. You are responsible for releasing the printing session object with the function doc://com.apple.documentation/documentation/applicationservices/1461402-pmrelease.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion This function allocates memory for a new printing session object in your application’s memory space and sets its reference count to 1. The new printing session object is initialized with information that the printing system uses for a print job.
