UIPrintPaper Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/UIKit.framework |
| Availability | Available in iOS 4.2 and later. |
| Companion guide | |
| Declared in | UIPrintPaper.h |
Overview
An instance of the UIPrintPaper class encapsulates the size of paper used for a print job and the rectangle in which content can be printed.
In most cases, UIKit automatically creates an instance of UIPrintPaper that is appropriate for a print job. The UIKit framework has default paper sizes based on a print job’s output type (outputType is a property of the UIPrintInfo class). If the output type is UIPrintInfoOutputPhoto, the default paper size is 4x6 or A6 or some other standard size, depending on locale; if the output type is UIPrintInfoOutputGeneral or UIPrintInfoOutputGrayscale, the default paper size is US Letter (8 1/2 by 11 inches) or A4 or some other standard size, depending on locale.
Applications may have special requirements for paper sizes. For example, a word-processing application may have items of “stationery” in which printable content must be drawn. If your application fits the special case, the delegate of UIPrintInteractionController can implement the printInteractionController:choosePaper: method of the UIPrintInteractionControllerDelegate protocol to return a suitable UIPrintPaper object. One way to do this is to call the bestPaperForPageSize:withPapersFromArray: class method of UIPrintPaper, passing in a array of UIPrintPaper objects representing the paper sizes supported by a printer. The UIPrintPaper object returned from this method represents the paper size best matched to the size requirement of the application.
The printable rectangle (printableRect) is the imageable area for the printer on a paper of a given size.
If you are using a UIPrintPageRenderer object to draw the content for printing, the rectangle stored in the printableRect property is stored in the page renderer’s property of the same name and the paper size used for a print job is stored as part of the paperRect property.
Tasks
Getting the Paper Size and the Printing Area
-
paperSizeproperty -
printableRectproperty
Obtaining the Best Paper Size for Printing
Properties
paperSize
The size of the sheet to be used for printing. (read-only)
Discussion
The paper size is often associated with a standard designation, such as “Letter” and “A4”. For example, the paper size for a Letter sheet of paper is 612 points wide and 792 points high.
Availability
- Available in iOS 4.2 and later.
See Also
Declared In
UIPrintPaper.hprintableRect
The rectangle that represents the portion of the paper that can be imaged upon. (read-only)
Discussion
Typically, UIKit passes this value into the last argument of the UIPrintPageRenderer method drawPageAtIndex:inRect:.
Availability
- Available in iOS 4.2 and later.
See Also
Declared In
UIPrintPaper.hClass Methods
bestPaperForPageSize:withPapersFromArray:
Returns the print-paper object that UIKit determines to be the best for a print job based on the given page size and the paper size–imageable area combinations specific to the printer.
Parameters
- pageSize
The size of the printed page that your application requests, in points. You should think of this as the size of the physical sheet of paper to use in printing without consideration of the margin.
- paperList
An array of
UIPrintPaperobjects that represent combinations of supported paper size and printable areas. The array of objects usually comes directly from the second argument of theprintInteractionController:choosePaper:method of theUIPrintInteractionControllerDelegateprotocol.
Return Value
An instance of UIPrintPaper that represents the optimal printable area and paper size for the current print job. Returns nil if the instance could not be created.
Discussion
The delegate of UIPrintInteractionController may call this method in its implementation of the printInteractionController:choosePaper: method declared in the UIPrintInteractionControllerDelegate protocol.
Availability
- Available in iOS 4.2 and later.
Declared In
UIPrintPaper.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-10-12)