It should "just work" without you having to do anything. It'll ask your view to 
image the rect, then it will scale it using a transform it has calculated to 
scale it to fit the paper. The pagination settng will be set to NSFitPagination 
when scaling the page to fit, just as you found. Unless the view is overriding 
it, the pagination will be a single vertical column of pages. -rectForPage: 
isn't called unless you are returning YES from -knowsPageRange according to 
documentation, but I believe that's not strictly true - it *is* called when 
'scale to fit paper' is checked as well, because it needs to know the rect so 
that it can calculate the scaling transform. But looking at the pagination 
setting will always return NSFitPagination, because it's only when that's set 
that the method is invoked in normal circumstances.

(Note, this is based on my own observation some time ago and may not be 
accurate - do your own tests. In fact 'fit to paper' is a newish standard 
feature of the print dialog - my app added its own back in the day and still 
has it. When I see my checkbox toggle, I change the pagination of the print 
info record between NSFitPagination and NSAutoPagination. The print system does 
the rest).

--Graham


> I cannot detect the value of the check-box "Scale to fit paper size" on the
> print panel. I would like to know whether I have to scale my view within the
> method 
> 
> - (NSRect)rectForPage:(NSInteger)pageNumber
> 
> For sure it has nothing to do with NSFitPagination. In facts
>    NSLog(@"pMode %ld, %ld",
>       [pi horizontalPagination], [pi verticalPagination]);
> 
> returns always 1, 1.
> 
> Any idea?
> 


_______________________________________________

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

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

Reply via email to