How to set up an NSView for printing?

638 views Asked by At

How can an NSView be set up for printing? For example, say I have a view in which I've overridden layout() to lay things out just as text does, flowing from one line to the next according to the width of the view. Nothing should scale, and the view needs to get taller (possibly requiring more pages) as it becomes more narrow.

What steps would I need to take in order to make print preview work and then actually print such a document? For example, I need to size the view to fit the page. At what point would I set the bounds, and where would I get the information on the size of the page? Do I print the view that's currently on screen, or should I create a new view with the same data?

I've read Customizing Content for the Printed Page, Not the Display, but I think drawRect is a later step than what I want.

0

There are 0 answers