Class

NSPrintInfo

An NSPrintInfo object stores information that’s used to generate printed output. A shared NSPrintInfo object is automatically created for an application and is used by default for all printing jobs for that application.

Overview

The printing information in an NSPrintInfo object is stored in a dictionary. To access the standard attributes in the dictionary directly, this class defines a set of keys and provides the dictionary() method. You can also initialize an instance of this class using the init(dictionary:) method.

You can use this dictionary to store custom information associated with a print job. Any non-object values should be stored as NSNumber or NSValue objects in the dictionary. See NSNumber for a list of types which should be stored as numbers. For other non-object values, use the NSValue class.

Beginning with OS X v10.5, to store custom information that belongs in printing presets you should use the dictionary returned by the printSettings method.

Symbols

Initializing an NSPrintInfo

init(dictionary: [String : Any])

Returns an NSPrintInfo object initialized with the parameters in the specified dictionary.

Managing the Shared NSPrintInfo

class func setShared(NSPrintInfo)

Sets the shared NSPrintInfo object to the specified object.

class func shared()

Returns the shared NSPrintInfo object.

Managing the Printing Rectangle

var bottomMargin: CGFloat

The height of the bottom margin.

var imageablePageBounds: NSRect

The imageable area of a sheet of paper specified by the receiver.

var leftMargin: CGFloat

The width of the left margin.

var orientation: NSPaperOrientation

The orientation attribute.

var paperName: String?

The name of the currently selected paper size.

var localizedPaperName: String?

The human-readable name of the currently selected paper size, suitable for presentation in user interfaces.

var paperSize: NSSize

The size of the paper.

var rightMargin: CGFloat

The width of the right margin.

var topMargin: CGFloat

The top margin to the specified size.

Pagination

var verticalPagination: NSPrintingPaginationMode

the vertical pagination to the specified mode.

Positioning the Image on the Page

var isHorizontallyCentered: Bool

A Boolean value indicating whether the image is centered horizontally.

var isVerticallyCentered: Bool

A Boolean value indicating whether the image is centered vertically.

Specifying the Printer

var printer: NSPrinter

The NSPrinter object to be used for printing.

Controlling Printing

var jobDisposition: String

The action specified for the job.

func setUpPrintOperationDefaultValues()

Validates the attributes encapsulated by the receiver.

Accessing the Print Info Dictionary

func dictionary()

Returns the receiver’s dictionary that contains the printing attributes.

Print Settings Convenience Methods

var isSelectionOnly: Bool

A Boolean that indicates whether only the currently selected contents should be printed.

var scalingFactor: CGFloat

The current scaling factor.

Accessing Core Printing Information

var printSettings: NSMutableDictionary

A mutable dictionary containing the print settings from Core Printing.

func pmPrintSession()

Returns a Core Printing object configured with the receiver’s session information.

func pmPageFormat()

Returns a Core Printing object configured with the receiver’s page format information.

func pmPrintSettings()

Returns a Core Printing object configured with the receiver’s print settings information

func updateFromPMPageFormat()

Synchronizes the receiver’s page format information with information from its associated PMPageFormat object.

func updateFromPMPrintSettings()

Synchronizes the receiver’s print settings information with information from its associated PMPrintSettings object.

Deprecated Methods

Constants

Print job attributes

These constants specify dictionary keys to access print job attributes.

NSPrintingPaginationMode

These constants specify the different ways in which an image is divided into pages. They’re used by horizontalPagination, and verticalPagination.

NSPrintingOrientation

These constants specify page orientations used by the property orientation.

Print job dispositions

These constants specify valid values for the print job attribute NSPrintJobDisposition. These constants are used the jobDisposition property.

Page setup attributes

These constants specify dictionary keys to access page format attributes.

Pagination attributes

These constants specify dictionary keys to access pagination attributes.

Relationships

Inherits From