Re: Printing in OSX...
Re: Printing in OSX...
- Subject: Re: Printing in OSX...
- From: Donald Brown <email@hidden>
- Date: Sun, 16 Jun 2002 20:48:51 -0500
Essentially, you create a view that will draw your output, and then call
something like this:
operation = [NSPrintOperation printOperationWithView:pView
printInfo:printInfo];
[pView release];
[operation setShowPanels:YES];
[operation runOperation];
Your print view needs to respond to a couple of different messages:
knowsPrintRange must return YES, after setting the range of pages in your
output.
- (BOOL)knowsPageRange:(NSRange *)rptr
{
rptr->location = 1;
rptr->length = pages;
return YES;
}
- (NSRect)rectForPage:(int)pageNum returns the rectangle in your view for
each page, from 1 to pages.
Finally, drawRect is called by the system to actually create the image.
No library to do reports yet that I know of, I just wrote code to print out
a report that required doing all the calculations first to figure out how
large the report would be, but it's not portable.
Donald
on 6/16/02 8:26 PM, Jiva DeVoe at email@hidden wrote:
>
I would like to add some printing abilities to an app I am working on. I
>
want more than just simple text, I'd like to do some nice formatting like
>
you see from word processors etc. How do these apps typically do this? Do
>
they hand-generate pdf output? Do they use directdraw to create a canvas
>
that represents their pages and then output that as pdf? Or what? Is there
>
a cool library that would make this easier than I am imagining it? Under
>
Windows I have used things like crystal reports to do reports very easily.
>
Is there something similar for OSX?
>
_______________________________________________
>
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.
--
Donald Brown
email@hidden
http://www.eamontales.com
We have met the enemy and he is us - Pogo
_______________________________________________
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.