---
title: "PMSessionSetDestination(_:_:_:_:_:)"
framework: applicationservices
role: symbol
role_heading: Function
path: applicationservices/1459855-pmsessionsetdestination
---

# PMSessionSetDestination(_:_:_:_:_:)

Sets the destination location, format, and type for a print job.

## Declaration

```swift
func PMSessionSetDestination(_ printSession: PMPrintSession, _ printSettings: PMPrintSettings, _ destType: PMDestinationType, _ destFormat: CFString?, _ destLocation: CFURL?) -> OSStatus
```

## Parameters

- `printSession`: The printing session that provides a context for the print job.
- `printSettings`: The print settings for the print job whose destination you want to set.
- `destType`: The destination type for the print job associated with the specified printing session and print settings. Possible values include: kPMDestinationPrinter (output to a printer) kPMDestinationFile (output to a file) kPMDestinationFax (output to a fax) kPMDestinationPreview (output to print preview) kPMDestinationProcessPDF (output to a PDF workflow option) See doc://com.apple.documentation/documentation/applicationservices/pmdestinationtype for a complete description of destination types you can specify.
- `destFormat`: The MIME type to be generated for the specified destination type. Pass NULL if you want to use the default format for the specified destination type. To obtain a list of valid formats for a given destination type, use the function doc://com.apple.documentation/documentation/applicationservices/1461332-pmsessioncopyoutputformatlist.
- `destLocation`: A reference to a Core Foundation URL that specifies a destination location. You can provide this if the destination type supports a destination location. Otherwise, pass NULL. For example, if the destination type is a file (kPMDestinationFile) you can supply a file system URL to specify where the file resides.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion You can use the function PMSessionSetDestination when you want to send print output to a file without requiring user interaction. You must call this function between the creation and release of a printing session. See the function PMCreateSession(_:).

## See Also

### Accessing the Print Job Destination

- [PMSessionGetDestinationType(_:_:_:)](applicationservices/1461071-pmsessiongetdestinationtype.md)
- [PMSessionCopyDestinationFormat(_:_:_:)](applicationservices/1464266-pmsessioncopydestinationformat.md)
- [PMSessionCopyDestinationLocation(_:_:_:)](applicationservices/1462967-pmsessioncopydestinationlocation.md)
- [PMSessionCopyOutputFormatList(_:_:_:)](applicationservices/1461332-pmsessioncopyoutputformatlist.md)
