• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Printing - taking advantage of full page size?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing - taking advantage of full page size?


  • Subject: Re: Printing - taking advantage of full page size?
  • From: Jim Correia <email@hidden>
  • Date: Tue, 29 Jan 2008 17:12:45 -0500

On Jan 29, 2008, at 1:34 PM, David Duncan wrote:

The pagination methods are still the best way to do this. You would simply state that your content has exactly 1 page that fills the size of the paper. Then when your -drawRect is invoked, it will be invoked to draw within the bounds of the page size you specified previously.

I guess I'm confused as to what your advice specifically is here. The rect passed to -drawRect: is the clipping rect. I use that to restrict myself to only drawing what is necessary. The contents of the view are already laid out (and possibly cached) relative to the view's bounds, which remains unchanged.


In my sample view I've added:

- (BOOL)knowsPageRange:(NSRangePointer)range
{
	range->location = 1;
	range->length = 1;
	return YES;
}

- (NSRect)rectForPage:(NSInteger)page
{
	NSPrintOperation *printOperation = [NSPrintOperation currentOperation];
	NSPrintInfo *printInfo = [printOperation printInfo];

	NSRect pageRect;

	pageRect.origin = NSZeroPoint;
	pageRect.size = [printInfo paperSize];

	NSLog(@"-rectForPage: %@", NSStringFromRect(pageRect));

	return pageRect;
}

At the top of -drawRect: I log

NSLog(@"-drawRect: %@, onScreen = %d, bounds = %@", NSStringFromRect(rect), [[NSGraphicsContext currentContext] isDrawingToScreen], NSStringFromRect([self bounds]));

When message as part of the print sequence, I see:

-rectForPage: {{0, 0}, {612, 792}}
-drawRect: {{0, 0}, {448, 205}}, onScreen = 0, bounds = {{0, 0}, {448, 205}}


Thanks,
Jim
_______________________________________________

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


References: 
 >Printing - taking advantage of full page size? (From: Jim Correia <email@hidden>)
 >Re: Printing - taking advantage of full page size? (From: David Duncan <email@hidden>)

  • Prev by Date: Re: How do I rotate an image?
  • Next by Date: Re: How do I rotate an image?
  • Previous by thread: Re: Printing - taking advantage of full page size?
  • Next by thread: "missing its dependency information"
  • Index(es):
    • Date
    • Thread