• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NewB] printing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NewB] printing


  • Subject: Re: [NewB] printing
  • From: Erik Buck <email@hidden>
  • Date: Fri, 3 Nov 2006 10:51:39 -0800 (PST)

Don't take my word for it.
  Create a new user interface in Interface Builder.  Place a text view in one of the windows.  Add the the Text or Format menus to the interface if you want paragraph styles, rulers, fonts, colors, etc.  Enter test interface mode.  Type some text.  Press Ctrl-P.

  You don't even have to compile the application to get printing to work.

  If you want, create a new application in X-code, do all of those steps in IB.  Save the nib.  Build and run.  Type some text.  Press Ctrl-P. Viola!

  Now, as it happens, NSDocument needs a little help to know which view to print, and the multi-document template for X-Code sets up the print menu item a little differently.  See
  <http://developer.apple.com/documentation/Cocoa/Conceptual/Printing/Tasks/PrintingDocs.html>

  The code in your original post is fine and nearly matches Apple's sample code for NSDocument at the provided link.  Note that TextEdit does NOT use the Cocoa NSDocument class and therefore does not require an implementation of - (void)printShowingPrintPanel:(BOOL)showPanels.  See http://developer.apple.com/documentation/Cocoa/Conceptual/Printing/Tasks/CreatingPrintJob.html

  The NSView class implements default printing:
  print:  This action method opens the Print panel, and if the user chooses an option other than canceling, prints the receiver and all its subviews to the device specified in the Print panel.
  - (void)print:(id)sender
  Parameters
sender
     The object that sent the message.
  Availability
   Available in Mac OS X v10.0 and later.
  See Also
   – dataWithEPSInsideRect:

   – writeEPSInsideRect:toPasteboard:

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: NSCell, copying, and objectValue
  • Next by Date: partially convert an nsimage to grayscale
  • Previous by thread: Re: [NewB] printing
  • Next by thread: Re: swizzling a class to a subclass inorder to add ivars (& methods) to a class
  • Index(es):
    • Date
    • Thread