Class

NSPrint​Info

An NSPrint​Info object stores information that’s used to generate printed output. A shared NSPrint​Info 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 NSPrint​Info 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 print​Settings method.

Symbols

Initializing an NSPrintInfo

init(dictionary:​ [String :​ Any])

Returns an NSPrint​Info object initialized with the parameters in the specified dictionary.

Managing the Shared NSPrintInfo

class func set​Shared(NSPrint​Info)

Sets the shared NSPrint​Info object to the specified object.

class func shared()

Returns the shared NSPrint​Info object.

Managing the Printing Rectangle

var bottom​Margin:​ CGFloat

The height of the bottom margin.

var imageable​Page​Bounds:​ NSRect

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

var left​Margin:​ CGFloat

The width of the left margin.

var paper​Name:​ String?

The name of the currently selected paper size.

var localized​Paper​Name:​ String?

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

var paper​Size:​ NSSize

The size of the paper.

var right​Margin:​ CGFloat

The width of the right margin.

var top​Margin:​ CGFloat

The top margin to the specified size.

Pagination

Positioning the Image on the Page

var is​Horizontally​Centered:​ Bool

A Boolean value indicating whether the image is centered horizontally.

var is​Vertically​Centered:​ 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 job​Disposition:​ String

The action specified for the job.

func set​Up​Print​Operation​Default​Values()

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 is​Selection​Only:​ Bool

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

var scaling​Factor:​ CGFloat

The current scaling factor.

Accessing Core Printing Information

var print​Settings:​ NSMutable​Dictionary

A mutable dictionary containing the print settings from Core Printing.

func pm​Print​Session()

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

func pm​Page​Format()

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

func pm​Print​Settings()

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

func update​From​PMPage​Format()

Synchronizes the receiver’s page format information with information from its associated PMPage​Format object.

func update​From​PMPrint​Settings()

Synchronizes the receiver’s print settings information with information from its associated PMPrint​Settings object.

Deprecated Methods

Constants

Print job attributes

These constants specify dictionary keys to access print job attributes.

NSPrinting​Pagination​Mode

These constants specify the different ways in which an image is divided into pages. They’re used by horizontal​Pagination, and vertical​Pagination.

NSPrinting​Orientation

These constants specify page orientations used by the property orientation.

Print job dispositions

These constants specify valid values for the print job attribute NSPrint​Job​Disposition. These constants are used the job​Disposition 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