Re: Hillegass printing challenge
Re: Hillegass printing challenge
- Subject: Re: Hillegass printing challenge
- From: Matt Neuburg <email@hidden>
- Date: Sat, 20 Feb 2010 09:26:36 -0800
- Thread-topic: Hillegass printing challenge
On Fri, 19 Feb 2010 11:56:53 +0000, Joanna Carter
<email@hidden> said:
>Can I just jump in on this thread and ask where I can find info about printing
a document like an invoice, where there is a header and then a list of invoice
lines that is possibly longer than one page?
Printing in Cocoa is easy - it's just drawing, with the added complication
of pagination (in particular, of knowing where you want to place page
boundaries so as to prevent a page element, such as one of your invoice
lines, from being split between two pages).
There's good info in the docs:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Printi
ng/Printing.html
For something as simple as you're describing, I would lay the whole thing
out in my view's init, storing info about where the divisions are between
each pair of invoice lines, and calling setFrameSize at the end so as to
make the view the right size to hold all the output. Then I would implement
adjustPageHeightNew and drawRect so as to use that info.
That's it, really. Based on your frame size and your responses in
adjustPageHeightNew, Cocoa will paginate for you, and when drawRect is
called, you draw the rect you're asked for.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden