UIPrintInfo Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 4.2 and later.
Companion guide
Declared in
UIPrintInfo.h
Related sample code

Overview

A UIPrintInfo object encapsulates information about a print job, including printer identifier, job name, output type (photo, normal, grayscale), orientation (portrait or landscape), and any selected duplex mode. This information is used by the printing system when it prints.

Typically you create a UIPrintInfo object and assign it to the printInfo property of the shared UIPrintInteractionController instance. However, it is not necessary to create a UIPrintInfo object for a print job; UIKit assumes certain defaults. In the printing-options user interface, users can select the printer, single-side or double-side printing for duplex printers, and (if the application allows it) a range of pages to print.

Tasks

Creating a UIPrintInfo Object

Getting and Setting Print-Job Attributes

Properties

duplex

Specifies the duplex mode to use for the print job.

@property(nonatomic) UIPrintInfoDuplex duplex
Discussion

Some printers can print either duplex (double-sided) or single-sided. If double-sided is selected, a printer can either print flipping the back page along the long edge of the paper or along the short edge. The default option for duplex-capable printers is based on document type: single-sided (none) for photos, double-sided and long edge for other documents. If a printer is capable of duplex printing, a switch in the printing options allows users to toggle between single-side and double-sided printing. See the description of the UIPrintInfoDuplex constants for more information.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

jobName

The name of the print job.

@property(nonatomic, copy) NSString *jobName
Discussion

The name of the print job is displayed in the Print Center when the job is printing. An application should set this property to a name appropriate to the content being printed. The default job name is the application name.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

orientation

The orientation of the printed content, portrait or landscape.

@property(nonatomic) UIPrintInfoOrientation orientation
Discussion

An application can set this property to a value thats appropriate to the printable content or it can put up a user interface that enables users to pick the printing orientation. The default value is UIPrintInfoOrientationPortrait. See the descriptions of the UIPrintInfoOrientation constants for more information.

Availability
  • Available in iOS 4.2 and later.
Related Sample Code
Declared In
UIPrintInfo.h

outputType

The kind of printable content.

@property(nonatomic) UIPrintInfoOutputType outputType
Discussion

The output type can be general, photo, or grayscale. An application can set this property to a value thats appropriate to the printable content. The default is UIPrintInfoOutputGeneral. See the descriptions of the UIPrintInfoOutputType constants for more information.

The output type controls the quality and default paper size used in printing. For example, if your application only prints black text, setting this property to UIPrintInfoOutputGrayscale can result in better performance in many cases. See UIPrintPaper Class Reference for details.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

printerID

An identifier of the printer to use for the print job.

@property(nonatomic, copy) NSString *printerID
Discussion

This property is set through user selection in the printing user interface. You may provide a printer ID as a hint (for example, the last printer used from a particular print job). The default value is nil.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

Class Methods

printInfo

Returns a print-information object initialized with default values.

+ (UIPrintInfo *)printInfo
Return Value

An instance of UIPrintInfo or nil if the object could not be created.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

printInfoWithDictionary:

Returns a print-information object that is initialized with the data in the passed-in dictionary.

+ (UIPrintInfo *)printInfoWithDictionary:(NSDictionary *)dictionary
Parameters
dictionary

A dictionary that contains data to initialize the UIPrintInfo object with.

Return Value

An instance of UIPrintInfo or nil if the object could not be created.

Discussion

You use the dictionary parameter to initialize a UIPrintInfo object with stored print-job information. Some applications might archive a previous UIPrintInfo object and use that for a future print job with this method.

You can later access the dictionary by calling the dictionaryRepresentation method on the UIPrintInfo object.

Availability
  • Available in iOS 4.2 and later.
See Also
Declared In
UIPrintInfo.h

Instance Methods

dictionaryRepresentation

Returns a dictionary representation of a print-information object.

- (NSDictionary *)dictionaryRepresentation
Return Value

A dictionary representation of a UIPrintInfo object that can be archived and used to create a new UIPrintInfo object. Returns nil if no dictionary can be created.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

Constants

UIPrintInfoDuplex

The duplex mode of a selected printer.

typedef enum {
   UIPrintInfoDuplexNone,
   UIPrintInfoDuplexLongEdge,
   UIPrintInfoDuplexShortEdge,
} UIPrintInfoDuplex;
Constants
UIPrintInfoDuplexNone

No double-sided (duplex) printing; single-sided printing only.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

UIPrintInfoDuplexLongEdge

Duplex printing that flips the back page along the long edge of the paper.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

UIPrintInfoDuplexShortEdge

Duplex print that flips the back page along the short edge of the paper.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

Discussion

You use these constants when setting the value of the duplex property of a UIPrintInfo object.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

UIPrintInfoOrientation

The orientation of printing on a page.

typedef enum {
   UIPrintInfoOrientationPortrait,
   UIPrintInfoOrientationLandscape,
} UIPrintInfoOrientation;
Constants
UIPrintInfoOrientationPortrait

Pages are printed in portrait orientation.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

UIPrintInfoOrientationLandscape

Pages are printed in landscape orientation.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

Discussion

You use these constants when setting the value of the orientation property of a UIPrintInfo object.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h

UIPrintInfoOutputType

The output type, which is an indication of the type of content the application is drawing or providing.

typedef enum {
   UIPrintInfoOutputGeneral,
   UIPrintInfoOutputPhoto,
   UIPrintInfoOutputGrayscale,
   UIPrintInfoOutputPhotoGrayscale
} UIPrintInfoOutputType;
Constants
UIPrintInfoOutputGeneral

Specifies that the printed content consists of mixed text, graphics, and images. The default paper is Letter, A4, or similar locale-specific designation. Output is normal quality, duplex.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

UIPrintInfoOutputPhoto

Specifies that the printed content consists of black-and-white or color images. The default paper is 4x6, A6, or similar locale-specific designation. Output is high quality, simplex.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

UIPrintInfoOutputGrayscale

Specifies that the printed content is grayscale. Set the output type to this value when your printable content contains no color—for example, it’s black text only. The default paper is Letter/A4. Output is grayscale quality, duplex. This content type can produce a performance improvement in some cases.

Available in iOS 4.2 and later.

Declared in UIPrintInfo.h.

UIPrintInfoOutputPhotoGrayscale

Specifies that the printed content is a grayscale image. Set the output type to this value when your printable content contains no color—for example, it’s black text only. The default paper is Letter/A4. Output is high quality grayscale, duplex.

Available in iOS 7.0 and later.

Declared in UIPrintInfo.h.

Discussion

You use these constants when setting the value of the outputType property of a UIPrintInfo object.

Availability
  • Available in iOS 4.2 and later.
Declared In
UIPrintInfo.h