• 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: How to implement a preview view for printing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to implement a preview view for printing


  • Subject: Re: How to implement a preview view for printing
  • From: Scott Thompson <email@hidden>
  • Date: Sat, 4 Mar 2006 21:48:42 -0600


On Mar 3, 2006, at 4:16 AM, Andreas Känner wrote:

I would like to implement my own preview view for printing. I can simulate a print operation by calling the relevant NSView methods in the same way NSPrintOperation does. But NSView can draw different things depending whether it is drawing to a screen or not. The view can ask the current graphics context with [NSGraphicsContext currentContextDrawingToScreen] if it is drawing to screen. A return value of NO means "draw for printing".

A return value of NO *might" mean draw for printing. It might also mean "draw for PDF export" or "draw into an offscreen image".


The problem is, that I want to tell the view that it is not drawing to screen, but I can't find something like [NSGraphicsContext setCurrentContextDrawingToScreen: NO].

Is there a way to fake this?

How are others doing this?

We use the "Preview" button that's already on the print dialog and let the application take the user to the Preview application.


If you're dead set against using the system behavior that the user will be familiar with from every other application on the system, you might try drawing your view into a PDF context and then drawing that PDF to your preview view. I suspect that will trigger the currentContextDrawingToScreen method, though I've not tried it myself.

Scott

_______________________________________________
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


References: 
 >How to implement a preview view for printing (From: Andreas Känner <email@hidden>)

  • Prev by Date: Core Data & prepareSavePanel
  • Next by Date: Re: NSTableView and background color
  • Previous by thread: How to implement a preview view for printing
  • Next by thread: Accessing CoreData Sqlite db from outside Cocoa app
  • Index(es):
    • Date
    • Thread