Re: NSPrintInfo and NSPageLayout
Re: NSPrintInfo and NSPageLayout
- Subject: Re: NSPrintInfo and NSPageLayout
- From: Ken Thomases <email@hidden>
- Date: Thu, 06 Oct 2011 21:42:08 -0500
On Oct 6, 2011, at 8:46 AM, Torsten Curdt wrote:
> 1) Currently I set the width of the view to the page size width minus
> the left and right margin. Frankly speaking I have no clue if that is
> the right thing to do. Or is imageablePageBounds the one to use?
I'm not sure. I know that you can get the PMPageFormat object from the NSPrintInfo and then call PMGetAdjustedPageRect() on it, if that helps. Hopefully others can provide a better answer.
> 2) When I configure the page layout with [[NSPageLayout pageLayout]
> runModal] the layout settings don't make it over to my print dialog.
> For example I tried to change the orientation but when I get the print
> dialog it's still in portrait. It's not that surprising as I don't see
> the connection between the two yet - but how do I make the connection?
The -runModal method uses the shared print info object, which can be obtained with +[NSPrintInfo sharedPrintInfo]. You can change the shared print info with +[NSPrintInfo setSharedPrintInfo:], if you have reason to. Alternatively, you can use -[NSPageLayout runModalWithPrintInfo:] to use a different print info for the page layout dialog.
In any case, you need to use the same print info object for the NSPrintOperation so that it can use that for the NSPrintPanel. That's how changes made in the page setup dialog get communicated to the print dialog. So, you can have both dialogs use the shared print info object (using the methods which don't take an explicit print info object) or you can specify your own print info object to both (passing the same object to the methods which do take an explicit print info object).
Regards,
Ken
_______________________________________________
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