Re: Printing in OSX...
Re: Printing in OSX...
- Subject: Re: Printing in OSX...
- From: Scott Anguish <email@hidden>
- Date: Mon, 17 Jun 2002 02:56:51 -0400
On Monday, June 17, 2002, at 01:12 AM, Jiva DeVoe wrote:
So how do I get the image/text/etc into the NSRect? The objective-c
version
seems to just be an origin and a size... I can't tell how it would store
image data?
I think there is some confusion here..
There are several ways to create your own reports...
1. Output the data in to an NSTextView using the append methods to
the NSTextStorage..
Pros: NSTextView does much of the work for you...
Cons: you need to create and append all the NSAttributedStrings, and
you're limited by the capabilities of the text system
2. Draw directly (what I think you meant by directdraw) using an
NSView subclass. Implement your own NSView subclass that will draw your
data (implement the -drawRect: method).. Then print this view (using
either the -print: method, or directly using NSPrintOperation if you
need more control).. when this happens the data is collected up as PDF
during the NSPrintOperation by calling your subclass's -drawSelf: and
doing it's magic.
Pros: totally customizable. The appkit attributed string stuff will
still cover off much of what you need too potentially
Cons: can be more work..
Note: You actually don't need to implement -knowsPageRange: or
-rectForPage: if the default pagination is good enough for you... BUT
you only get vertical pagination by default.. you need to turn on
horizontal pagination in the NSPrintInfo object if you want that too...
3. Cheat like mad. Design your output 'form' in IB. Yep.. this
will work.. you can use IB as a sort of form generation tool.. make a
view (likely in an NSScrollView) that has NSTextField's and NSTextViews
where you need the stuff printed on the final page, and then populate
those in your code and send that view a -print.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.