On Fri, 19 Feb 2010 11:56:53 +0000, Joanna Carter
<cocoa...@carterconsulting.org.uk> 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 = m...@tidbits.com, <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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to