PMSessionCreatePrinterList(_:_:_:_:)
Creates a list of printers available in the specified printing session.
Declaration
func PMSessionCreatePrinterList(_ printSession: PMPrintSession, _ printerList: UnsafeMutablePointer<Unmanaged<CFArray>?>, _ currentIndex: UnsafeMutablePointer<CFIndex>?, _ currentPrinter: UnsafeMutablePointer<PMPrinter?>?) -> OSStatusParameters
- printSession:
The printing session whose printer list you want to obtain.
- printerList:
A pointer to your Cfarray variable. On return, the variable refers to a Core Foundation array containing a list of printers available in the specified printing session. Each element in the array is a Core Foundation string that contains a printer’s name as shown in the user interface. You are responsible for releasing the array.
- currentIndex:
A pointer to your Cfindex variable. On return, the variable contains a value specifying where the current printer is in the printer list.
- currentPrinter:
A pointer to your Pmprinter variable. On return, the variable refers to a printer object that represents the current printer. You should not release the printer object without first retaining it. If the printer is the generic printer, the variable is set to
NULL.
Return Value
A result code. See Result Codes.
Discussion
You must call this function between the creation and release of a printing session. See the function PMCreateSession(_:).
You can call the function PMSessionCreatePrinterList to obtain a valid printer name to pass to the function PMSessionSetCurrentPrinter.
Special Considerations
In macOS 10.2 and later, Apple recommends using the function PMServerCreatePrinterList(_:_:) instead. PMServerCreatePrinterList doesn’t require a PMSession object; it can be called at any time. It also works directly with PMPrinter objects.