<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://commons.oreilly.com/wiki/skins/common/feed.css?97"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://commons.oreilly.com/wiki/index.php?title=Learning_Cocoa_with_Objective-C/Miscellaneous_Topics/Printing&amp;action=history&amp;feed=atom</id>
		<title>Learning Cocoa with Objective-C/Miscellaneous Topics/Printing - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://commons.oreilly.com/wiki/index.php?title=Learning_Cocoa_with_Objective-C/Miscellaneous_Topics/Printing&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Learning_Cocoa_with_Objective-C/Miscellaneous_Topics/Printing&amp;action=history"/>
		<updated>2013-05-23T15:08:02Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.11.0</generator>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Learning_Cocoa_with_Objective-C/Miscellaneous_Topics/Printing&amp;diff=6274&amp;oldid=prev</id>
		<title>Docbook2Wiki: Initial conversion from Docbook</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Learning_Cocoa_with_Objective-C/Miscellaneous_Topics/Printing&amp;diff=6274&amp;oldid=prev"/>
				<updated>2008-03-07T12:56:06Z</updated>
		
		<summary type="html">&lt;p&gt;Initial conversion from Docbook&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Learning Cocoa with Objective-C/TOC}}&lt;br /&gt;
In the past, code to handle printing has been difficult to write. Many factors, such as margins, page orientation, and paper size, come into play. The differences in drawing models (between screen drawing and drawing to the printer) have made things even more challenging. Cocoa provides a clean printing interface that uses the same drawing model used to draw to the screen. In addition, just as Cocoa supports the use of calibrated color when drawing to the screen, ColorSync provides advanced color management when printing to paper.&lt;br /&gt;
&lt;br /&gt;
As we saw in [[Learning Cocoa with Objective-C/Single-Window Applications/Custom Views|Chapter 7]], when a view object receives a &amp;lt;tt&amp;gt;drawRect:&amp;lt;/tt&amp;gt; message, it responds by drawing itself into the current graphics context. Usually, this context is a frame buffer, and the &amp;lt;tt&amp;gt;drawRect:&amp;lt;/tt&amp;gt; message results in the view drawing its contents to the screen. The same machinery is used during printing, but the current graphics context is set to be the printer.&lt;br /&gt;
&lt;br /&gt;
Remember (as discussed in [[Learning Cocoa with Objective-C/Single-Window Applications/Custom Views|Chapter 7]]) that the &amp;lt;tt&amp;gt;drawRect:&amp;lt;/tt&amp;gt; method is never called directly to make a view appear on the screen; it is called only when the display message is sent to the view. The same methodology applies to printing; the &amp;lt;tt&amp;gt;drawRect:&amp;lt;/tt&amp;gt; method is called when a &amp;lt;tt&amp;gt;print:&amp;lt;/tt&amp;gt; message is sent to the view. Calling &amp;lt;tt&amp;gt;print:&amp;lt;/tt&amp;gt; on a view causes the AppKit to display a print panel that asks the user which printer she wishes to use (along with page setup information). When the user clicks the Print button of the print panel, a sequence of &amp;lt;tt&amp;gt;drawRect:&amp;lt;/tt&amp;gt; messages—one for each page—is sent to the view.&lt;br /&gt;
&lt;br /&gt;
This chapter focuses on enabling basic printing from Cocoa applications. As with most things, once you have mastered the basics, you can make printing fairly complex—such as adding UI elements to the print panel and using alternate text views to reflow text—to satisfy special needs.&lt;br /&gt;
&lt;br /&gt;
== Printing a View ==&lt;br /&gt;
&lt;br /&gt;
Since Cocoa makes it so easy to print a view, we're not going to waste any time. The following steps guide you through creating your first print job.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Create a new Cocoa Application project in Project Builder (File → New Project → Application → Cocoa Application) named &amp;quot; View Print&amp;quot;, and save it in your ''~/LearningCocoa''folder.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Use the Finder to locate the ''Ripples Blue.jpg''file (''/Library/Desktop Pictures''), and drag it to the Resources group of your project.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Open the ''MainMenu.nib'' file in Interface Builder. Click the Images tab on the MainMenu.nib window, and notice that the image we just added is present.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Drag an Image View (&amp;lt;tt&amp;gt;NSImageView&amp;lt;/tt&amp;gt;) from the Other Cocoa Views palette onto the main window, and then resize it to be larger, as shown in [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-FIG-1|Figure 12-1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-FIG-1&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 12-1. An Image View in the application window'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Learning Cocoa with Objective-C_I_1_tt470.png|An Image View in the application window]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Drag the Ripples Blue image from the MainMenu.nib window to the Image View that we just added. When you drop the image onto the view, you should see the image appear there.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Control-drag a connection from the File → Print menu item to the Image View. The inspector will pop up, if it's not already open, and indicate that the menu item is connected to &amp;lt;tt&amp;gt;FirstResponder.print:&amp;lt;/tt&amp;gt;. Disconnect this connection, and connect the File → Print menu item to the &amp;lt;tt&amp;gt;print:&amp;lt;/tt&amp;gt; action of the view, as shown in [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-FIG-2|Figure 12-2]]. Be careful when dragging the connection, as it's easy to select the window as the target of the action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-FIG-2&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 12-2. Creating a connection from the print menu item'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Learning Cocoa with Objective-C_I_1_tt471.png|Creating a connection from the print menu item]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Save ([[Image:Learning Cocoa with Objective-C_I_1_tt472.png|]]-S) the nib file, and return to Project Builder.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Build and run the project ([[Image:Learning Cocoa with Objective-C_I_1_tt473.png|]] -R).&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Select Print (File → Print, or [[Image:Learning Cocoa with Objective-C_I_1_tt474.png|]]-P) in the running application. The print dialog box will open, as shown in [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-FIG-3|Figure 12-3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-FIG-3&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 12-3. The print dialog panel in action'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Learning Cocoa with Objective-C_I_1_tt475.png|The print dialog panel in action]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Click the Preview button. The application prints to a PDF file that will be displayed in the Preview application. Repeat the process, and click Print if you want to see the results printed on your printer.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you have printed the view, notice that the entire image view drew itself onto the printer—border and all—and appears just as it did onscreen. If you just wanted to draw the image itself to the printer, you'd need to add a little code to control what gets printed. In the next section, we'll do just that with text.&lt;br /&gt;
&lt;br /&gt;
== Using Print Operations ==&lt;br /&gt;
&lt;br /&gt;
Usually, you'll want more control over your printing than was available in our View Print application. This control is provided in Cocoa by creating print operations (instances of the &amp;lt;tt&amp;gt;NSPrintOperation&amp;lt;/tt&amp;gt; class) and running them. You can think of a print operation as a controller object that mediates between the underlying print machinery of Mac OS X and the view being printed. Print operations use a helper object of type &amp;lt;tt&amp;gt;NSPrintInfo&amp;lt;/tt&amp;gt; to help them determine how the page should be printed. If the print operation is constructed without a print info object, a default print info object for the application will be used.&lt;br /&gt;
&lt;br /&gt;
We'll show you how to use print operations and print info objects in conjunction with printing using the document architecture, as covered in [[Learning Cocoa with Objective-C/Document-Based Applications/Multiple Document Architecture|Chapter 10]] and [[Learning Cocoa with Objective-C/Document-Based Applications/Rich-Text Handling|Chapter 11]].&lt;br /&gt;
&lt;br /&gt;
=== Printing Using the Document Architecture ===&lt;br /&gt;
&lt;br /&gt;
To enable simple printing from a document-based application simply requires that a &amp;lt;tt&amp;gt;printShowingPrintPanel:&amp;lt;/tt&amp;gt; method be implemented in the document class. This method is called by the document architecture on the active document when a user selects File → Print or presses [[Image:Learning Cocoa with Objective-C_I_1_tt476.png|]] -P.&lt;br /&gt;
&lt;br /&gt;
To show this in action, we will create a simple editor that just prints the contents of the text document. So we can just focus on the printing-related code, we're going to create a new editor rather than using the one we just built. The following steps will guide you:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Create a new Document-Based Application in Project Builder (File → New Project → Application → Cocoa Document-based Application) named &amp;quot;Document Print&amp;quot;, and save it in your ''~/LearningCocoa''folder.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Design the GUI by opening the ''MyDocument.nib''file in Interface Builder and performing the following steps:&lt;br /&gt;
&lt;br /&gt;
# Remove the default text field.&lt;br /&gt;
# Drag an &amp;lt;tt&amp;gt;NSTextView&amp;lt;/tt&amp;gt; from the Cocoa Data Views palette to the application's window.&lt;br /&gt;
# Resize the text view so that it occupies the entire window.&lt;br /&gt;
# Change the Autosizing options so that the view will follow changes in the window's size.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;In Project Builder, open ''MyDocument.h'', and add a declaration as follows for the text view's outlet:&lt;br /&gt;
&lt;br /&gt;
 #import &amp;lt;Cocoa/Cocoa.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 @interface MyDocument : NSDocument&lt;br /&gt;
 {&lt;br /&gt;
 &lt;br /&gt;
 '''    IBOutlet NSTextView * textView;'''&lt;br /&gt;
 }&lt;br /&gt;
 @end&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Save (File → Save, or [[Image:Learning Cocoa with Objective-C_I_1_tt478.png|]] -S) ''MyDocument.h''; then drag it onto Interface Builder's MyDocument.nib window so that Interface Builder can pick up the change to the file.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Control-drag a connection from the File's Owner object (remember, this is a proxy for the &amp;lt;tt&amp;gt;MyDocument&amp;lt;/tt&amp;gt; instance at runtime), and connect it to the &amp;lt;tt&amp;gt;textView&amp;lt;/tt&amp;gt; outlet.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Save (File → , or [[Image:Learning Cocoa with Objective-C_I_1_tt479.png|]]-S) the nib file.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;In Project Builder, open ''MyDocument.m'' and add the &amp;lt;tt&amp;gt;printShowingPrintPanel:&amp;lt;/tt&amp;gt; method as shown here:&lt;br /&gt;
&lt;br /&gt;
                         '''- (void)printShowingPrintPanel:(BOOL)flag'''&lt;br /&gt;
                         '''{'''&lt;br /&gt;
                         '''    NSPrintInfo * printInfo = [self printInfo];                        // a'''&lt;br /&gt;
                         '''    NSPrintOperation * printOp;                                        // b'''&lt;br /&gt;
                         '''    printOp = [NSPrintOperation printOperationWithView:textView        // c'''&lt;br /&gt;
                         '''                                             printInfo:printInfo];'''&lt;br /&gt;
                         '''    [printOp runOperation];                                            // d'''&lt;br /&gt;
                         '''}'''&lt;br /&gt;
                      &lt;br /&gt;
&lt;br /&gt;
The code we added performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
# Obtains a reference to the &amp;lt;tt&amp;gt;printInfo&amp;lt;/tt&amp;gt; object used by the document. This object is created automatically by Cocoa's document architecture for each document.&lt;br /&gt;
# Declares a &amp;lt;tt&amp;gt;printOp&amp;lt;/tt&amp;gt; variable of type &amp;lt;tt&amp;gt;NSPrintOperation&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Creates a new print operation that will print the contents of our text view using the print information that we obtained in line a.&lt;br /&gt;
# Calls the &amp;lt;tt&amp;gt;runOperation&amp;lt;/tt&amp;gt; method on the print operation object. This puts the printing machinery into play.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Save the project (File → Save, or [[Image:Learning Cocoa with Objective-C_I_1_tt481.png|]]-S).&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Build and run ([[Image:Learning Cocoa with Objective-C_I_1_tt482.png|]] -R) the application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Create some text and then print it (File → Print, or [[Image:Learning Cocoa with Objective-C_I_1_tt483.png|]]-P). A print dialog box will appear, as shown in [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-FIG-4|Figure 12-4]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Click either the Print button (to send the print job to your printer) or the Preview button (to send the print information to the Preview application, as shown in [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-FIG-5|Figure 12-5]]). We recommend that you use the Preview button as you work through this chapter so that a few sheets of paper can be saved.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-FIG-4&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 12-4. Printing from a document-based application'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Learning Cocoa with Objective-C_I_1_tt484.png|Printing from a document-based application]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-FIG-5&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 12-5. Printed document in Preview.app'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Learning Cocoa with Objective-C_I_1_tt485.png|Printed document in Preview.app]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Use the Page Setup (File → Page Setup, or Shift-[[Image:Learning Cocoa with Objective-C_I_1_tt486.png|]]-P) functionality to change the paper size and the orientation used.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setting Margins ==&lt;br /&gt;
&lt;br /&gt;
When printing text documents, we don't usually want the text centered on the page; we'd rather have it printed from the top-lefthand corner with some given margin.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Modify our &amp;lt;tt&amp;gt;printShowingPanel:&amp;lt;/tt&amp;gt; method as follows:&lt;br /&gt;
&lt;br /&gt;
 - (void)printShowingPrintPanel:(BOOL)flag&lt;br /&gt;
 {&lt;br /&gt;
     NSPrintInfo * printInfo = [self printInfo];&lt;br /&gt;
     NSPrintOperation * printOp;&lt;br /&gt;
 '''    [printInfo setTopMargin:36.0];                                     // a'''&lt;br /&gt;
                      '''    [printInfo setLeftMargin:36.0];                                    // b'''&lt;br /&gt;
 &lt;br /&gt;
                      '''    [printInfo setHorizontallyCentered:NO];                            // c'''&lt;br /&gt;
                      '''    [printInfo setVerticallyCentered:NO];                              // d'''&lt;br /&gt;
     &lt;br /&gt;
     printOp = [NSPrintOperation printOperationWithView:textView&lt;br /&gt;
                                              printInfo:printInfo];&lt;br /&gt;
     [printOp runOperation];&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The code we added performs the following tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Sets the top margin of the printed page to 36 points (1/2 inch). Points are a unit of measure used in page layout and typography, based on a scale of 72 points per inch. See [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-TABLE-1|Table 12-1]] for a quick reference.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-TABLE-1&amp;quot;&amp;gt;&lt;br /&gt;
'''Table 12-1. Points to inches conversion chart'''&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Point Size !! Measurement in Inches&lt;br /&gt;
|-&lt;br /&gt;
| 9 || 1/8&lt;br /&gt;
|-&lt;br /&gt;
| 18 || 1/4&lt;br /&gt;
|-&lt;br /&gt;
| 27 || 3/8&lt;br /&gt;
|-&lt;br /&gt;
| 36 || 1/2&lt;br /&gt;
|-&lt;br /&gt;
| 45 || 5/8&lt;br /&gt;
|-&lt;br /&gt;
| 54 || 3/4&lt;br /&gt;
|-&lt;br /&gt;
| 63 || 7/8&lt;br /&gt;
|-&lt;br /&gt;
| 72 || 1&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Sets the left margin of the printed page to 36 points.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Indicates that the printed view should not be horizontally centered on the page.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Indicates that the printed view should not be vertically centered on the page.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Save the project (File → Save, or [[Image:Learning Cocoa with Objective-C_I_1_tt488.png|]]-S).&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;div&amp;gt;Build and run ([[Image:Learning Cocoa with Objective-C_I_1_tt489.png|]]-R) the application. Now, when you print out a block of text, it will be printed starting at the upper-left corner, as shown in [[Learning Cocoa with Objective-C/Miscellaneous Topics/Printing#learncocoa2-CHP-12-FIG-6|Figure 12-6]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;learncocoa2-CHP-12-FIG-6&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 12-6. Printing at the top-left corner'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Learning Cocoa with Objective-C_I_1_tt490.png|Printing at the top-left corner]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete information on the settings for a print info object can be found in the ''/Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/Printing/index.html'' file installed on your hard drive with the Developer Tools.&lt;br /&gt;
&lt;br /&gt;
== Exercises ==&lt;br /&gt;
&lt;br /&gt;
# Add a Font menu to the application, and print out files with various fonts.&lt;br /&gt;
# Add printing to the Dot View application that we created in [[Learning Cocoa with Objective-C/Single-Window Applications/Event Handling|Chapter 8]].&lt;br /&gt;
# Resize the image view in View Print to occupy the entire window (don't forget to set the Autosizing attributes!), and experiment with printing other images.&lt;/div&gt;</summary>
		<author><name>Docbook2Wiki</name></author>	</entry>

	</feed>