---
title: "PMPrintSettingsSetValue(_:_:_:_:)"
framework: applicationservices
role: symbol
role_heading: Function
path: applicationservices/1461697-pmprintsettingssetvalue
---

# PMPrintSettingsSetValue(_:_:_:_:)

Stores the value of a setting in a print settings object.

## Declaration

```swift
func PMPrintSettingsSetValue(_ printSettings: PMPrintSettings, _ key: CFString, _ value: CFTypeRef?, _ locked: Bool) -> OSStatus
```

## Parameters

- `printSettings`: The print settings object you want to update.
- `key`: A string constant that specifies the key for the desired setting. Some keys are currently defined in PMTicket.h; other keys are user-defined.
- `value`: A Core Foundation object that corresponds to the specified key. If you pass NULL, any existing setting for the specified key is removed.
- `locked`: If true, the item being set should be locked; otherwise, false. Currently, you should always pass false.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion This function makes it possible to add, change, or remove print settings directly. Print settings are stored as key-value pairs. The keys are Core Foundation strings and the corresponding values are Core Foundation objects. You can use this function to store user-defined data in a print settings object. You should make sure that the custom keys you define for your private data do not conflict with any other keys in the object. Each data item you store needs to be a Core Foundation object. You can use the function PMPrintSettingsGetValue to retrieve your private data. If you call this function after initiating a print job (for example, by calling PMSessionBeginCGDocument), the change is ignored for the current job.

## See Also

### Accessing Data in Print Settings Objects

- [PMGetFirstPage(_:_:)](applicationservices/1460271-pmgetfirstpage.md)
- [PMSetFirstPage(_:_:_:)](applicationservices/1461519-pmsetfirstpage.md)
- [PMGetLastPage(_:_:)](applicationservices/1462747-pmgetlastpage.md)
- [PMSetLastPage(_:_:_:)](applicationservices/1463595-pmsetlastpage.md)
- [PMGetPageRange(_:_:_:)](applicationservices/1459324-pmgetpagerange.md)
- [PMSetPageRange(_:_:_:)](applicationservices/1462294-pmsetpagerange.md)
- [PMPrintSettingsGetJobName(_:_:)](applicationservices/1459233-pmprintsettingsgetjobname.md)
- [PMPrintSettingsSetJobName(_:_:)](applicationservices/1460149-pmprintsettingssetjobname.md)
- [PMGetCopies(_:_:)](applicationservices/1464480-pmgetcopies.md)
- [PMSetCopies(_:_:_:)](applicationservices/1463804-pmsetcopies.md)
- [PMGetCollate(_:_:)](applicationservices/1464492-pmgetcollate.md)
- [PMSetCollate(_:_:)](applicationservices/1463223-pmsetcollate.md)
- [PMGetDuplex(_:_:)](applicationservices/1458921-pmgetduplex.md)
- [PMSetDuplex(_:_:)](applicationservices/1462000-pmsetduplex.md)
- [PMPrintSettingsGetValue(_:_:_:)](applicationservices/1460602-pmprintsettingsgetvalue.md)
- [PMPrintSettingsCopyAsDictionary(_:_:)](applicationservices/1459088-pmprintsettingscopyasdictionary.md)
- [PMPrintSettingsCopyKeys(_:_:)](applicationservices/1462730-pmprintsettingscopykeys.md)
