Re: Confused about NSPrintInfo margins
Re: Confused about NSPrintInfo margins
- Subject: Re: Confused about NSPrintInfo margins
- From: Graham Cox <email@hidden>
- Date: Fri, 10 Jul 2009 11:48:00 +1000
Thanks Joel, certainly setting the margins directly does work. What
I'm left wondering is what they are actually for - they are never set
by he Page Setup panel and never change with changes to paper size,
printer, etc.
My conclusion is that these fields are merely a convenience for
specifying arbitrary user margins, and if you want to use them you
have to a) add UI to set them and b) make use of them in your code
somewhere. By default they do nothing, are ignored and have no effect
whatsoever on printing unless your code decides not to ignore them.
Unfortunately this is all guesswork as the docs do not discuss it
anywhere I can find. At the very least I will file a bug asking for
better documentation on this.
However I would love to hear from someone in the print group whether
I'm right about this, since I am writing stuff into my app to handle
page layout/printing and proceeding on this assumption could prove to
be a mistake.
--Graham
On 10/07/2009, at 5:22 AM, Joel Norvell wrote:
Graham,
I'm not sure if this is exactly what you were talking about, but I
did a test in the printShowingPrintPanel of a program I'd written.
The NSPrintInfo methods setLeftMargin, setBottomMargin,
setRightMargin and setTopMargin all affect the margin values within
the NSPrintInfo instance.
Here's the test code with the before and after values I saw.
- (void)printShowingPrintPanel:(BOOL)flag
{
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
float testLeft = [printInfo leftMargin];
float testBottom = [printInfo bottomMargin];
float testRight = [printInfo rightMargin];
float testTop = [printInfo topMargin];
// L, T, R, B IS NOW 72, 90, 72, 90
[printInfo setLeftMargin: 0];
[printInfo setBottomMargin: 0];
[printInfo setRightMargin: 0];
[printInfo setTopMargin: 0];
testLeft = [printInfo leftMargin];
testBottom = [printInfo bottomMargin];
testRight = [printInfo rightMargin];
testTop = [printInfo topMargin];
// L, T, R, B IS NOW 0, 0, 0, 0
...
}
This was done using Xcode 3.1.3.
HTH,
Joel
_______________________________________________
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